HANOI (Reuters) - U.S. Secretary of State John Kerry expressed confidence on Friday that an ambitious Pacific trade pact could be completed this year and said a recent nuclear deal with Iran proved hurdles in international agreements could be overcome.

Kerry said many challenges remained in thrashing out a Trans-Pacific Partnership (TPP), particularly on issues of autos and dairy, but the United States would do everything in its power to make it happen.

"We can complete this negotiation by the end of this year and we are going to do everything possible to work through these differences," he told students in Hanoi.

The U.S.-inspired TPP is a "mega regional" accord set to cover 12 countries with a combined gross domestic product of $28 trillion, among them Australia, Japan and the United States.

Kerry likened the TPP talks to a deal negotiated over 18 months between Iran and six other countries to lift sanctions in return for curbs on a nuclear program Iran insists is for peaceful purposes.

"When you get 12 nations together, it's very complicated. I will tell you that having just negotiated with Iran ... there were six of us all with expertise, all with our own opinions and we had to come together in order to agree on what we would then negotiate with Iran.

"This is the same thing," he said of the TPP.

The TPP would connect the 12 economies by cutting trade barriers and harmonizing standards covering two-fifths of the world economy and a third of global trade.

TPP trade ministers discussing the pact, which would stretch from Japan to Chile, have said an agreement is within reach, despite the failure last week to settle differences at talks in Hawaii.

Kerry met Vietnamese President Truong Tan Sang and said it was crucial to iron out remaining issues.

"One of the very important things now is for us to be able to stay where we are on the TPP negotiations, not to slide backwards, but to finish that job in which Vietnam is very much an important contributor," Kerry said.

Vietnam's export-dominated economy could be among the biggest beneficiaries of the TPP because of its farm and fisheries resources, cheap labor and growing manufacturing sector, especially in textiles, footwear, telephones and televisions. Among its investors are Samsung, LG and Microsoft.

Vietnam has some lingering concerns on TPP, including issues related to labor, which Kerry said could be settled.

"I think your government is very much prepared with us to help complete that," he said.