San Diego ranked second in the nation for retirement readiness, trailing only residents of Hartford and New Haven, Conn., according to a national survey conducted by wealth management firm Ameriprise Financial.

In the third annual survey, Ameriprise surveyed about 10,000 people living in 30 metropolitan areas, including 300 here.

San Diego moved up one spot this year from its 2011 ranking as the No. 3 most retirement ready city, Ameriprise said.

While the overall message from the survey shows that nearly half of U.S. residents are worried about outliving their retirement savings, in San Diego most expressed confidence about the future.

Nearly half of those surveyed locally, 48 percent, said they are on track for retirement, compared with 37 percent nationally who said that.

To a question on whether they are very prepared financially for retirement, 26 percent of those in San Diego replied in the affirmative, while only 16 percent agreed with that statement on a national level.

Fifty-eight percent of San Diego residents said they were setting aside funds in their own retirement accounts, while the national average was 47 percent.

Local residents were also more likely to have consulted with a financial adviser — 33 percent, compared with only 26 percent of the entire group surveyed who has done so, Ameriprise said.

Only 23 percent of local respondents said they postponed retirement because they didn’t save enough, compared with 33 percent of the rest of the nation who said that. However, 44 percent of local folks responded that they were forced to leave the workforce early due to a job loss or setback, compared to only 31 percent who did so nationally.