BAGHDAD, Iraq (CNN) -- Robert Gates is greeted Monday at Baghdad International Airport by Army Lt. Gen. Lloyd Austin.
Gen. Ray Odierno will take over command Tuesday from Gen. David Petraeus, whose 20-month term in Iraq saw a significant decline in violence with the deployment of additional U.S. troops.
U.S. forces are in "mission transition," Gates said Monday, with some troops going home and others backing up Iraqis.
"There is no question we will still be engaged, but the areas in which we are seriously engaged will continue to narrow," Gates said during his flight to Iraq.
"The challenge for Odierno is how do we work with the Iraqis to preserve the gains we've already achieved and expand on them even as the number of U.S. forces are shrinking."
Odierno is expected to set the stage for an eventual U.S. withdrawal.
Petraeus will become the new chief of U.S. Central Command, in charge of American forces in the Middle East and Afghanistan.
Gates, who is making his eighth trip to Iraq, said Petraeus played a "historic role" during his tenure.
Find journalists' killers, PM orders
"I think he would be the first to acknowledge that he has had a brilliant strategy," he said. "But it has been the brigade commanders and company commanders and the soldiers and Marines and others on the ground who have actually made it work.
"We have lost a lot of lives, but it's really been an extraordinary effort of translations of a great strategy into a great success in a very difficult circumstance."
At a dinner on the eve of the change-of-command ceremony, Gates presented Petraeus with the Defense Superior Service Medal. He also gave Ryan Crocker, the U.S. ambassador to Iraq, the Distinguished Civilian Service Award -- the highest award given by the secretary of Defense to those not in uniform.
"I have never seen a working relationship like this," Gates told the two men. "To find leaders to do what many considered impossible, you two are such men."
Odierno will receive his fourth star on Tuesday in a separate ceremony ahead of the change-of-command ceremony.
The defense secretary on Monday also met with Iraqi Prime Minister Nuri al-Maliki and told the Iraqi leader that he has seen a notable improvement in security since his first visit to the country nearly two years ago, according to a statement released by the prime minister's office.
Gates said the cooperation between Iraqi security forces and coalition forces was responsible for the improvement in security, according to the statement, and al-Maliki praised the successes of the Iraqi armed forces.
The prime minister said the gains have brought about a greater sense of normalcy in the country, allowing many internally displaced Iraqis to return to their homes. They also have spurred the economy, he said.
The situation in Iraq is far different from that in past years, the prime minister noted.
As Gates arrived in Iraq, three bombings -- two in Baghdad and one in Diyala province's Balad Ruz -- provided a rude counterpoint to that message.
Two car bombs went off in central Baghdad. The blasts killed 12 people and wounded 36 in the commercial area of the Karrada district, an Interior Ministry official said. The U.S. blamed al Qaeda in Iraq, but gave a lower death toll, saying two "possible" car bombs killed six people and wounded 27.
In Balad Ruz, a female suicide bomber detonated explosives at the house of a former U.S. detainee, killing at least 22 people and wounding 33, according to a Diyala security official.
The U.S. military also blamed al Qaeda in Iraq for a car bombing Friday in Dujail, north of Baghdad. The Interior Ministry said at least 30 people were killed and 45 wounded; the U.S. said 31 were killed and 40 were wounded.