Richard Perry/The New York Times

Despite the lingering effects of the recession, more people visited New York City in 2010 than in any previous year, according to an estimate announced by Mayor Michael R. Bloomberg on Tuesday.

Speaking at Brooklyn Botanic Garden, Mr. Bloomberg said that the city drew 48.7 million tourists last year, a record total that would put the city back on track to reaching the mayor’s goal of attracting 50 million visitors annually by next year. The estimated increase of almost 7 percent came after tourism in the city dipped to slightly more than 45 million visitors in 2009.

Visitors, many of them flush with foreign currencies that had extra buying power against a weak dollar, flocked to the city’s hotels and museums even though ticket prices and room rates were rising. The average rate paid for a hotel room in Manhattan in 2010 was more than $250, but the occupancy rate still increased to more than 85 percent, according to figures compiled by Colliers PKF Consulting USA.

All told, tourists spent $31 billion in the city last year.

The numbers gave the mayor something positive to talk about after a week of nearly nonstop criticism of how his administration handled the blizzard that struck on the day after Christmas. They also helped to validate his decision several years ago to take control of the city’s main tourism promoter, NYC & Company, and support it with more than $15 million a year.

“The strength of our tourism industry is one of the reasons New York City was less impacted by the national recession than other cities, and it continues to be one of the reasons we’re growing faster than other cities today,” Mr. Bloomberg said.

He said that the city had added 6,600 hotel rooms in 2010. He said that the hospitality industry — hotels, restaurants, museums and attractions — added 6,600 jobs and now employed more people than ever before.