Moody's Investors Service on Wednesday revised its outlook on Spain's government bond rating to stable from negative, citing a rebalancing of the country's economy.

Moody's also affirmed Spain's Baa3 government bond rating.

For the medium term, the outlook for Spain's economy is brighter, Moody's said.

"From our perspective, with a stable outlook, we see risks broadly balanced," said Kathrin Muehlbronner, a senior credit officer with Moody's in London.

"We certainly see the positive signs in the economy," Muehlbronner said. But she cautioned that "our expectations are for relatively moderate growth going forward."

Moody's said in a statement that its outlook on the Spanish economy "supports Moody's view that Spain's public finances are on a slowly improving trend."

The ratings agency also said Spain was less likely to see its access to international lending markets cut off and noted "the significant reduction in contingent liabilities for the sovereign emanating from the Spanish banking sector over the past year."

Spain's economy has contracted around 7.5 percent since 2008, when the bursting of a decade-long property bubble left millions out of work and sent domestic demand into freefall.

The rebound, led by the export sector, is expected to be shallow, due in part to stubbornly high unemployment. The European Union expects unemployment to stay above 25 percent through 2015.

Spain has one of the euro zone's highest budget deficits and took aid from its euro-zone peers to help rescue its banks.

Standard & Poor's rates the country BBB-minus with a stable outlook. Fitch rates the country BBB with a stable outlook.