TOKYO (Reuters) - Prime Minister Shinzo Abe won a ruling party leadership vote on Thursday, putting him on track to become Japan’s longest-serving premier and to try to cement his legacy, including by revision of the country’s pacifist, post-war constitution.

If Abe, who quit abruptly after a troubled 2006-07 term, stays in office through November 2019, he will have exceeded the 2,886 days marked by Taro Katsura in the early 20th century.

“I want to tackle constitutional reform together with all of you,” Abe told his Liberal Democratic Party (LDP) after the vote.

Abe, who surged back to power in 2012 promising to reboot the economy and strengthen national defense, defeated former defense minister Shigeru Ishiba in the LDP leadership election.

Abe won 553 votes to Ishiba’s 254, a somewhat stronger showing than expected. Of the 810 votes up for grabs from LDP parliamentarians and rank-and-file members, 807 were valid.

Abe told a news conference he would reshuffle his cabinet after coming back from a trip to New York for a United Nations General Assembly gathering next week. He declined to comment on specific posts, but the Nikkei business daily said his close allies, Chief Cabinet Secretary Yoshihide Suga and Finance Minister Taro Aso, would stay.

Abe also said he would compile an extra budget for relief from the natural disasters - floods and earthquakes - that have battered Japan in recent months.

Abe’s first immediate challenge, however, is an expected summit next week with U.S. President Donald Trump, when he will face pressure to narrow Japan’s $69 billion trade surplus with its key ally, nearly two-thirds from auto exports.

Abe is expected to meet Trump on the sidelines of the U.N. gathering.

Trump congratulated his “good friend” Abe in a Twitter post on Thursday and said, “I’m looking forward to many more years of working together.”

While the two leaders have forged close ties, Trump has made clear he is unhappy with the bilateral trade imbalance and wants a two-way agreement to address it.

Tokyo opposes a bilateral deal for fear it would boost pressure on traditionally sensitive sectors, such as agriculture.

The Trump administration is also exploring raising tariffs on Japanese auto exports, a step officials in Tokyo say would do serious damage to the two economies and world trade.

Slideshow ( 10 images )

BEATING DEFLATION

Abe, whose policy-makers must keep growth on track with a dwindling policy tool-kit, said the central bank’s efforts to achieve its 2 percent inflation target, coupled with government steps to beat deflation, had succeeded in creating more jobs.

“The biggest goal of our macroeconomic policy has been fulfilled as a result of measures taken by the government and the BOJ to achieve 2 percent inflation,” Abe said, signaling he was no longer insisting on hitting the elusive inflation target.

Slideshow ( 10 images )

He added that he would strive to pave the way to end deflation during his new three-year term.

After years of heavy money printing, the Bank of Japan has little ammunition left. Japan’s huge public debt and rising social welfare costs for a fast-ageing population also leave Abe with little room to ramp up fiscal spending.

Abe has pledged to reform social security, making it easier for people to stay in the workforce and offset Japan’s shrinking population by raising the retirement age to above 65 and letting them defer pension payouts beyond age 70.

He has said he will implement a planned rise in the sales tax to 10 percent from 8 percent in October 2019, but that could hit the economy just as Trump’s protectionist policies could hurt Japanese exports.

Revising the constitution’s Article 9 to clarify the military’s ambiguous status is one of Abe’s long-held goals. The article, if taken literally, bans the maintenance of armed forces but has been interpreted to allow a military for self-defense.

The amendment would be a largely symbolic change, yet pushing for it would be politically risky since the public is divided. Amendments require approval by two-thirds of both houses of parliament and a majority in a public referendum.

Ishiba favors a more drastic reform but has said changing Article 9 was not a top priority now.