Spain's public deficit fell to the equivalent of 6.62 percent of total economic output in 2013 from 6.84 percent in 2012, just failing to meet a 6.5-percent target, budget minister Cristobal Montoro told a news conference.
"It is a positive figure, especially because it was a year of recession," Montoro said.
"Spain is reducing its public deficit," he added.
The deficit figure excludes the cost of a €41-billion($56 billion) rescue loan agreed by Spain's eurozone partners in 2012 to help shore up Spanish banks' balance sheets, many of them weakened by a 2008 property crash.
"We are already entering the recovery path," Montoro declared.
Prime Minister Mariano Rajoy's conservative government has struggled to contain annual deficits by raising taxes, freezing public salaries and curbing spending on items such as education and health care despite angry street protests.
Spain's gross domestic product shrank by 1.2 percent overall in 2013 despite beginning to show growth mid-year.
The unemployment rate topped 26 percent at the end of the year as the nation struggled with the aftermath of a decade-long property bubble bursting.
Despite that difficult environment, the Spanish government has promised the European Union it will lower the public deficit to 5.8 percent of GDP this year, 4.2 percent next year and 2.8 percent in 2016.
For now, the public deficit remains well above the EU ceiling of 3.0 percent of GDP, but comfortably below a giddy 2009 peak of 11.1 percent of GDP.
Spain's total accumulated public debt climbed to the equivalent of 93.9 percent of GDP in 2013 from 86.0 a year earlier, the Bank of Spain said this month.