The third seed and five-time champion at his hometown tournament thrilled a sellout 9,200 crowd at the St Jakobshalle with the fightback which keeps him solidly in the chase for a place in the season-wrapup event in London next month.
Federer, now into the quarterfinals, stands provisional seventh in the field but needs strong showings this week at home and next week at the Paris Masters to ensure his passage into the year-end event which he has won six times.
The 32-year-old Swiss advanced in just under two hours, recovering after losing the first set against the Uzbek outsider, then claiming the second to pull even.
The third set was a true test for the 17-time grand slam winner who has had a dismal 2012 season, Federer laid down a marker as he held serve for 1-1 in the final set, winning that eight-minute game after saving four break points.
From then on, the momentum shift was complete for the Swiss favourite, who coasted into the last eight, firing a backhand winner on his first match point.
"I started poorly, making too many errors, especially on the forehand," said Federer.
"I was risking too much and it was not paying off," he said.
"I had to cut that risk and was a bit lucky to win," the Basel native acknowledged.
"I started fighting back and got better as the match went on," he said.
"I'm happy that I was able to turn it around, I needed a match like this."
Defending tournament winner Juan Martin del Potro began his title defence in the first round with a defeat of Finnish-born Swiss youngster Henri Laaksonen, with the number 244 becoming a 6-4, 6-4 victim of the top seed.
Del Potro is riding a run of form after winning Tokyo and playing the Shanghai final.
"I played OK for the first match of the week," said the winner, who has already qualified into the World Tour Finals year-end field.
"He was nervous at the start," Del Potro said.
"I took my break points when I could and that was that," he said.
"I served well and took my chances."
France's Richard Gasquet put himself in the danger zone for qualifying for London as the fatigued fifth seed lost 6-4, 6-2 to compatriot Michael Llodra.
The first-round defeat in 70 minutes still leaves Gasquet standing a provisional ninth in the points race.
Gasquet, who lost in the Shanghai first round and rebounded by winning the Moscow title last weekend, admitted that he was out of energy.
"I was tired after playing a lot of matches," said the player who qualified for the year-end event in 2007 when it was played in Shanghai.
"It was a long flight from Moscow and the conditions here, the court and the balls, are completely different," he said.
"Plus Michael was playing very well, it was very tough for me today," Gasquet said.
"It's disappointing to lose but now I need to rest and then try to play well in Paris," he said.
"It's my last chance."
Gasquet's Moscow success marked his third title of the season, after Doha and Montpellier.
He earned his only Basel result of note last year when he reached the semi-finals against eventual champion del Potro.
France's Paul-Henri Mathieu advanced to the second round as he beat American Denis Kudla 6-4, 7-5.
Canadian Vasek Pospisil earned revenge for a loss last week as he beat Robin Haase 6-4, 6-4.