WASHINGTON — Timothy Cook came to the lion’s den on Capitol Hill on Tuesday, prepared to face down lawmakers furious over evidence that Apple, the famous company he runs, had avoided paying billions in taxes. By the time Mr. Cook walked out, the big cats on a Senate committee were practically eating out of his hand.

Even the panel’s fiery chairman, Senator Carl Levin of Michigan, after blasting Apple for creating “ghost companies” that diverted billions of tax dollars from American coffers and caused needy seniors to go without meals, had some kind words for Mr. Cook and his company.

“We love the iPhone and the iPad,” Mr. Levin said, going on to commend Mr. Cook and two other executives for voluntarily appearing before the Senate Permanent Committee on Investigations. “I know it’s not easy to come in front of a spotlight but it’s important for us.”

Other senators seemed even more mollified by Mr. Cook’s low-key performance.

Senator John McCain, the senior Republican on the panel, who had earlier criticized Apple “as among America’s largest tax avoiders,” took pains to modulate his message. “You managed to change the world, which is an incredible legacy for Apple,”he told Mr. Cook.