Chuck Hagel, the US defence secretary, has held talks with Nawaz Sharif, Pakistan's prime minister, as part of an effort to defuse tensions over controversial US drone strikes and Pakistan's role in Afghanistan.
During Monday's meeting in Rawalpindi, Hagel and Sharif pledged to work together to strengthen the countries' relationship.
The last Pentagon chief to visit Pakistan was Robert Gates in January 2010.
Ties between the US and Pakistan have been seriously strained over US drone raids in Pakistan's tribal belt as well as Afghan Taliban sanctuaries inside Pakistan's borders.
But the Pakistani government says "substantial progress" has been made in repairing the relationship.
Hagel was visiting the country "in recognition of the tremendous support that Pakistan has provided in the war on terror", a senior US defence official said before his arrival.
'Friction in relationship'
Hagel wants "to deepen our defence partnership" and to affirm continued US military assistance, the official said.
"There is some friction in the relationship" and Hagel wants to tackle that "head on" to try to forge a better understanding between the two countries, he said.
Due to security concerns, Hagel's visit was a "guarded secret", Al Jazeera's Kamal Hyder, reporting from Islamabad, said.
He described as "upbeat" the Pakistani government's response to the visit, while noting that since July 2012 Pakistan had received close to $1.2bn in military aid from the US.
"The Pakistani [government] is very keen to continue that strategic partnership with the United States despite those serious differences," he said.
In recent weeks, activists opposed to the drone raids forcibly searched lorries in northwest Pakistan in a campaign to disrupt NATO supply routes to and from Afghanistan.
The club-wielding protesters have prompted US officials to halt the shipments to protect the safety of lorry drivers ferrying NATO equipment.
Contractors were still concerned over anti-drone protests and a suspension of the arrangement had not been lifted, officials travelling with Hagel said.
The crossing is the main overland route used by the Americans and NATO to withdraw tonnes of military hardware from Afghanistan as part of a massive troop pullout set to wrap up by the end of 2014.
President Barack Obama has defended the drone strikes as an effective, lawful tool used with restraint to target suspected al-Qaeda fighters.
But human rights groups and Pakistani politicians say the missile attacks have killed innocent civilians and must stop.
US officials are reportedly anxious to forge a constructive dialogue with the new army chief General Raheel Sharif, who is expected to be at the centre of decision-making on sensitive security questions.
Hagel said through a spokesman that he looked forward to discussing with his counterparts "the United States and Pakistan's common interest in a stable Afghanistan".
Pakistan is seen as crucial to peace in neighbouring Afghanistan as it was a prominent backer of the 1996-2001 Taliban regime in Kabul and is believed to shelter some of the group's leaders.
Pakistan is battling a homegrown Taliban insurgency but US officials have long accused the country's spy service of maintaining ties to the Afghan Taliban, as a hedge to counter any potential threat from India in neighbouring Afghanistan.
Hagel landed in Pakistan after two days in Afghanistan, where he urged the country's president, Hamid Karzai, to sign a long-delayed security agreement that will allow NATO-led forces to stay in the country after 2014.
Hagel began his trip last week in Bahrain, seeking to reassure Gulf Arab allies that the US would retain a robust military presence in the region despite an interim nuclear deal with Iran.
Source: Al Jazeera and agencies