Gates met US commanders to discuss security in the area and then left for Baghdad.
He is expected to urge Iraq's leaders to take advantage of reduced violence to bridge deep differences between the Shia and Sunni communities.
Geoff Morrell, the Pentagon press secretary, travelling with Gates, said: "Secretary Gates is here to see for himself the considerable progress that has been made since his last visit nearly three months ago.
"He will be visiting with Iraqi leaders including Prime Minister (Nuri al-) Maliki to get their take on the situation and to see what more they can do to capitalise on the gains that have been made since the surge of US forces in Iraq."
George Bush, the US president, sent an extra 30,000 soldiers to Iraq earlier this year to try to pull the country back from the brink of all-out sectarian civil war and to give Iraq's leaders "breathing space" to reach a political accommodation.
With attacks reportedly at their lowest levels in nearly two years, attention has focused on whether the Shia-led government can reconcile with disaffected Sunni Arabs, especially as the United States begins to draw down troops.
Armed men, however, killed two US soldiers and wounded two others in northern Salahuddin province on Tuesday, the US military said.
Colonel Raymond Thomas, an assistant commander of the US division responsible for the north, said it was asking for more troops for Diyala province, of which Baquba is the capital.
John Negroponte, the US deputy secretary of state, said earlier in the week, after a visit to Iraq, that the country's leaders must take advantage of improved security and enact laws aimed at reconciliation or risk a resumption of sectarian bloodshed.
US military figures show attacks across Iraq have fallen 55 per cent since a build-up pf American troops became fully deployed in mid-June. That deployment coincided with the growing use of neighbourhood security units to guard local communities.
US military commanders say they are confident they can maintain gains in security despite the planned withdrawal of more than 20,000 soldiers over the next six to eight months.
There are around 160,000 American troops in Iraq.