It was Mr Bush's first visit to Iraq since November 2003 and was marked by the tightest security and secrecy. Even Mr Maliki learned that he was to see the president only minutes before they met.
The president gave his unequivocal backing to the new prime minister, a Shiite whose government was formed almost half a year after elections, saying he was impressed by the composition of the Iraqi cabinet and its strategy.
"I appreciate you recognising that the future of your country is in your hands," Mr Bush said. "If given the right help, I'm convinced you'll succeed.
"I've come to not only look you in the eye. I've also come to tell you that when America gives its word, it will keep its word," said Mr Bush.
Secret departure
The US President had left his Camp David ranch in secret overnight to make the surprise visit.
"I'm impressed by the cabinet that you've assembled... I'm impressed the strength of your character and your desire to succeed. And I'm impressed by your strategy," he told the premier.
Mr Maliki, who described the meeting as a "milestone for good relations", vowed that Iraq was "determined to succeed and defeat terrorism. We will defeat terrorism with the support and partnership of the United States.
"God willing, all the suffering will be over and all the soldiers will return to their countries," Mr Maliki said.
Mr Bush also used his visit to thank US troops in Iraq. "I thank you for your sacrifice. I thank you for your service. I thank you for making history," he told about 300 soldiers at the US embassy in Baghdad.
Commenting on lengthy tours of duty in Iraq, Mr Bush said "I understand long deployments are tough. They're tough on you and they're tough on your families.
"The people of this country suffered under the hands of a brutal tyrant. And thanks to the United States forces and coalition forces, the people are liberated from the clutches of Saddam Hussein," said Mr Bush to strong applause.
"America's safer. The world is better off. And the Iraqi people have a chance to realise the great blessings of liberty because Saddam Hussein is no longer in power."
However, he warned that tough days lay ahead. Referring to how Iraqi women want their children to grow up in a peaceful world, to be well educated and to live in peace, he said: "It's a common desire and it's one that you all are helping the Iraqis realise. It's important work, it's vital work, and it's historic work."
Insurgent crackdown
Promising to crack down on insurgents, Mr Bush said "what happens here in Iraq reaches far beyond the borders of Iraq. The war on terror really is - will be addressed by strong actions by our intelligence and military services to bring to justice those who would do us harm."
"And when Iraq succeeds, and it will, the rest of the world, particularly in the Middle East, will see such a hopeful example of what's possible."
Mr Bush has come under increasing political fire at home over a war that has claimed the lives of nearly 2,500 US troops.
The president, together with his advisors, earlier strode into the domed atrium of the US embassy in Baghdad and shook hands with Maliki.
"Good to see you," said the Iraqi prime minister. "Thanks for having me," replied Mr Bush.
The meeting was originally expected to be a video conference from Mr Bush's ranch in the United States.
The president's visit comes almost a week after Al-Qaeda leader in Iraq Abu Musab al-Zarqawi was killed in a US air strike, an event hailed by Washington as a major breakthrough in the war against the insurgency.
It also came as at least 32 people were killed in Iraq, including 18 in five car bomb attacks in the oil city of Kirkuk, underlining how horrific violence has become daily routine in the country.
The visit also coincides with the promised implementation of Maliki's much-vaunted new security plan for Baghdad which will include extending the nightly curfew and 40,000 US and Iraqi troops patrolling the capital.
The president was accompanied on the trip by senior aides National Security Advisor Stephen Hadley, Chief of Staff Josh Bolten, White House counsellor Dan Bartlett, Deputy Chief of Staff Joe Hagan and White House spokesman Tony Snow, according to a pool reporter travelling with him.
On his last visit, Bush flew in to eat an emotional Thanksgiving dinner with 600 soldiers on November 27, 2003, a visit also organized under the greatest secrecy.
Mr Bartlett told reporters the trip was planned over the past month by a small group of six White House insiders including Secretary of State Condoleezza Rice, Vice President Dick Cheney and Defence Secretary Donald Rumsfeld.
