MADRID--Spain's budget deficit narrowed significantly last year, the government said Friday, meeting the target agreed with the European Commission for the first time since the start of a property bust in 2008.

Deputy Prime Minister Soraya Sáenz de Santamaría said the eurozone's fourth-largest economy posted last year a deficit equivalent to 5.7% of gross domestic product, slightly below the commission's target of 5.8%-of-GDP deficit.

Ms. Sáenz de Santamaría said budget cuts and economic growth both helped Spain bring the deficit in line with government commitments. The economy grew 1.4% in 2014, the first year in which it expanded since 2008, slightly above the commission's and the government's projections.

In 2013, Spain's deficit had stood at 7% of GDP, compared with 6.5% of GDP agreed with the commission.

The improvement in Spain's fiscal picture is also because the government didn't earmark any funds to bailout the country's banking sector, after two years in which the European Union injected the equivalent of 4.3% of Spain's GDP into the country's banks (3.8% in 2012, 0.5% in 2013), inflating the country's government debt and deficit in the process.

Spain's Budget Minister Cristóbal Montoro said the country faced an unexpected one-off expense last year, after an EU court forced the government to give back close to EUR2 billion ($2.2 billion) in taxes it ruled as illegal.

In the absence of this item, Mr. Montoro added, the budget deficit would have been at 5.5% of GDP, in line with government projections.

Spain's numbers show the country remains among a small group of economic outperformers along the eurozone periphery, just as major economies in the monetary area--like France and Italy--fail to gain traction, and Greece faces a risky slide toward insolvency.

Portugal, the eurozone's poorest county, said Thursday its budget deficit stood at 4.5% of GDP, down from 4.8% of GDP in 2013, discounting the funds injected in Novo Banco SA, the lender created from the collapse of Banco Espírito Santo SA.

Portugal had requested a EUR78 billion bailout from the EU and the International Monetary Fund in 2011 after investors lost confident in the country's ability to service its debt. Portugal's deficit stood at 7.4% of GDP then, and Lisbon is committed to bring the deficit this year to 2.7% of GDP.

Spain, meanwhile, is hoping to cut the deficit to 4.2% of GDP this year, a task that should be made easier by an accelerating economy.

Spain's central bank Thursday said GDP may grow 0.8% in the first quarter from the last quarter of 2014 as lower consumer prices drive domestic demand, and 2.5% on an annual basis.

The Bank of Spain also raised its forecast for economic growth this year to 2.8% from 2% previously. In 2016, the central bank said it expects the economy to grow 2.7%.

Ms. Sáenz de Santamaría said Friday that the government will present its own updated economic projections in late April.

Write to David Román at david.roman@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires