Tony Blair promised "unswerving support" for Gordon Brown as prime minister at an emotional farewell Cabinet meeting, Downing Street said.
Tony Blair said it was the 'right moment to go'
And Mr Brown told Mr Blair anything he achieved in the future would be because he was "standing on your shoulders".
Mr Blair received a standing ovation from colleagues at the end of an "extraordinary" hour-long meeting.
He was presented with a print of the prime minister's country residence, Chequers, as a leaving gift.
Deputy Prime Minister John Prescott, who is also standing down, was presented with a print of Admiralty Arch, where he has a grace and favour apartment.
The gifts were paid for by an earlier Cabinet whip-round.
Mr Prescott said he was "immensely proud" of what the government had achieved and would "leave office with his head held high".
Mr Blair hailed Mr Prescott's intelligence and shrewdness and said he had been a "wonderful colleague".
He said Mr Brown, who takes over from him next week, had all the qualities to be a great prime minister and he offered the chancellor his "unswerving support".
"It is the right moment to go," Mr Blair told the Cabinet.
Commons leader Jack Straw led tributes to Mr Blair, saying he would be remembered as one of the most successful prime ministers ever.
He said Mr Blair had faced up to the tough decisions that needed to be taken for the country and had made it a better place.
He had tackled racial and gender prejudice and created a society "at ease with itself".
Mr Straw also paid warm tribute to Mr Prescott, praising his "courage" and saying he had transformed the country's infrastructure, with projects such as the Channel Tunnel rail link.
In his farewell tribute to Mr Blair, Mr Brown said people would "look back in 100 years time and see the achievements that Tony Blair has made".
The changes he had made would be "historic and enduring", added Mr Brown.
He pointed to Northern Ireland, the way Mr Blair had responded to the 7 July bombings and terrorism and securing the 2012 Olympics as examples of Mr Blair's lasting achievements.
He also hailed civil partnerships, the way Mr Blair had "transformed public services" and his leadership on global poverty and climate change.
"Whatever we achieve in the future it will be because we are standing on your shoulders," he told Mr Blair, adding he had been "proud" to serve with the prime minister and deputy prime minister.
Mr Blair's official spokesman said the prime minister was given a standing ovation which only ended when he left the room.
David Miliband later described the meeting as "extraordinary", as he apologised to Commons Speaker Michael Martin for his late arrival in the chamber for environment questions.
"I hope you will allow me to thank you and the House for allowing me to be a few minutes late for today's question time given the extraordinary nature of the Cabinet meeting that's been happening," the environment secretary told Mr Martin.
"The tolerance of the House, I'm sure, is related to the fact that it understands it takes a very long time to enumerate all the achievements of the Prime Minister and the Deputy Prime Minister."
It took "still more time to cross the floods of tears that are now trailing down Downing Street", he added.
Shadow Foreign Secretary William Hague, for the Conservatives, said Mr Blair had "amazing" political talents and had been "good at winning elections".
But he added: "I think he has been a much better party leader than prime minister.
"He wouldn't get a standing ovation from most of the country."
He said Mr Brown faced a more difficult job, as he "struggles with the fact that he has been in office for the last 10 years" and "has often tried to obstruct many of the good things that Tony Blair has tried to do".