TOKYO — A dozen years ago, Shinzo Abe was a disgraced politician who was forced to resign after just one year as Japan’s prime minister, following a humiliating defeat of his party in a parliamentary election over the summer.
On Sunday, voters head to the polls in a different parliamentary election, but this time Mr. Abe, 64, is likely to seal his place in history as the longest-serving prime minister in Japan.
If, as widely expected, the governing Liberal Democratic Party wins a majority in the national elections for the upper house of Parliament, Mr. Abe, who returned to power in 2012, will be just four months shy of setting Japan’s leadership record.
On Saturday night at his party’s final campaign rally in Tokyo, supporters waved Japanese flags as Mr. Abe promised to secure the country’s finances and touted his personal relationship with President Trump. “We will firmly protect Japan,” he said.
With polls showing the Liberal Democrats far ahead of the main opposition party, the Constitutional Democrats, analysts said the biggest question was whether Mr. Abe’s party, along with its coalition partners, could win a two-thirds supermajority of seats in Parliament that could allow Mr. Abe to realize his long-held ambition of revising Japan’s pacifist Constitution.
Mr. Abe is leading in the polls despite struggling to accomplish his other professed goals, including turbocharging the economy, raising the country’s sluggish birthrate or dramatically increasing the proportion of women in management and politics. In many ways, Mr. Abe’s success stems from the lack of a strong opposition rather than a public mandate for his party’s vision.
“The opposition is no good,” said Makoto Mugikura, 68, a voter who had wandered into the rally not as an ardent supporter but because he happened to be drinking in the neighborhood. “There is nothing but the Liberal Democrats.”
With five major opposition parties, many voters have a hard time keeping them straight. New parties crop up in each election as old parties split and reconstitute.
“The opposition’s problem comes down to marketing and identity,” said Jeffrey W. Hornung, a political scientist at the RAND Corporation who focuses on Japan. “It’s hard to be able to have any sort of consistent voice when you come and go with different elections, and Abe and the L.D.P. have been able to capitalize on that.”
Some of the opposition parties hoped to distinguish themselves by putting forward more female candidates.
Under a law enacted last year, Japan’s political parties are encouraged to strive for gender parity in their candidates. A record 28 percent of candidates in the election on Sunday are women, with the Constitutional Democratic Party fielding a slate that is almost half female.
While Mr. Abe often says he envisions a society in which “women can shine,” fewer than one in six candidates for the Liberal Democratic Party are women, and there is only one woman in his cabinet.
Mr. Abe’s agenda for women is “window dressing,” said Noriko Sakoh, the author of “Doing Too Much Housework Will Destroy Japan.” She pointed to government policies such as tax abatements for husbands whose wives do not work and persistent waiting lists for government-subsized day care despite the low birthrate.
Ms. Sakoh said she was attracted to a new progressive party called Reiwa Shinsengumi, which is backing a range of candidates from diverse backgrounds, including a single mother and two people with physical disabilities.
In a country where one-fifth of the population is now 70 or older, all the major parties focused on the national pension system during the campaign.
Just under two months before the election, the Financial Services Agency, a government regulator, warned that the country’s social security system would not be able to support the living standards of the elderly through retirement. Given the long life expectancies in Japan, the agency’s report suggested that an average couple would need an additional 20 million yen, or about $185,000, to live comfortably.
Officials in the Abe administration swiftly repudiated the report, and on the campaign trail Mr. Abe promised to increase annual pensions for low-income retirees by about $560.
Such pledges rang hollow to some protesters who showed up for Mr. Abe’s final rally on Saturday, shouting “Abe quit!” and “Don’t bully poor people!”
Mr. Abe has said the government will fund the payments by encouraging more women and the elderly to work, and his party has vowed to raise the country’s consumption tax to 10 percent in the fall, as previously scheduled.
All five major opposition parties have said they would not raise the tax, although Yukio Edano, leader of the Constitutional Democrats, says the government has a responsibility to secure the retirement of its citizens.
“Isn’t it the job of the government to figure out how we can build a system that will work even if people don’t save 20 million yen?” he said last month.
In his final campaign speech on Saturday, Mr. Abe dismissed the opposition’s criticism.
“Regarding pensions and other social security benefits, the opposition parties are only fanning unease among the people without presenting alternative plans,” he said. “Without raising burdens, we cannot increase social security.”
A supporter at the rally said he did not plan to depend on the government for his retirement.
“I will take care of myself,” said Ichiro Hasumi, 65, a retired shipping company worker who said he was voting for Mr. Abe’s party because “he will best protect the national interest.”
“It’s Japan first,” he added.
Mr. Abe has worked hard to establish himself as a leader on the world stage, persistently courting Mr. Trump and working to improve ties with President Xi Jinping of China. During Mr. Trump’s visit to Japan in May, the relationship seemed to pay off when the American president said on Twitter that he would hold off on thorny trade negotiations until after the Japanese election this month.
For the opposition, it can be hard to counter such symbols of Mr. Abe’s power. It is also difficult to break through to a public that values stability or offer compelling new ideas for how to solve the country’s most difficult long-term problems, which are dictated by the demographics of a declining population and aging society.
“The challenges that Japan faces are very complicated, so there are in general not a lot of easy answers,” said Kristi Govella, assistant professor of Asian studies at the University of Hawaii at Manoa. “Opposition parties tend to get pushed into an anti-Abe or anti-status-quo position, and that can be a difficult place to build a base of new, exciting policy ideas from.”