Before the news briefing began, President Obama returned a tie he borrowed from Gibbs before speaking at the 2004 Democratic National Convention in Boston.
"He has not said anything about this tie all these years," Obama told the White House press corps. "But I have to tell you that I know there's a simmering resentment that he never got it back."
The tie was presented as a piece of framed art and Gibbs could break the glass if he really wanted to wear the blue neckwear, Obama said.
On a more serious note, Obama said, "Robert has not only been an extraordinary press secretary, but he has been a great friend. And you could not ask for somebody better in the foxhole with you during all the twists and turns of my candidacy, and then the incredible challenges that we faced over the last two years."
Gibbs said he would remain involved in politics, making public appearances to defend the president and help in the 2012 re-election campaign. He will be replaced by Jay Carney, a former Time magazine journalist who is Vice President Biden's communications director.
Gibbs said it was a "tremendous honor and privilege" to serve as Obama's press secretary, especially on days "like today that are so momentous," when Egyptian President Hosni Mubarak resigned.
He thanked his staff and others behind the scenes, saying he wouldn't have made it though without them.
"You all are forever a part of this experience for me," Gibbs told reporters. "You've become a greater extension of my family. We've shared a lot of extraordinary times."
Celebrity Breakups and divorces of 2014 [PHOTOS]