TOKYO — As polls closed in Japan on Sunday after lackluster turnout in national elections, voters appeared to have delivered a victory to the governing party of Shinzo Abe and its allies, according to the public broadcaster NHK, all but ensuring his place in history as the country’s longest-serving prime minister.
It was not yet clear whether Mr. Abe and his allies had also secured two-thirds of the seats in the Upper House of Parliament, a supermajority needed to fulfill his long-cherished ambition of revising a pacifist Constitution that has been in place since American occupiers created it in 1947.
Nevertheless, the projected result represented a striking moment for Mr. Abe, who just a dozen years ago was forced to resign in disgrace after one year as prime minister, following a humiliating defeat of his party in a parliamentary election. Now, Mr. Abe, who returned to power in 2012, is just four months shy of setting Japan’s leadership record.
During the campaign, Mr. Abe did not emphasize his desire to revise the Constitution, 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.
Mr. Abe appeared headed to secure the electoral victory 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-subsidized 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. On Sunday evening, Kyodo News said that Yasuhiko Funago, a candidate who uses a wheelchair and has amyotrophic lateral sclerosis, had won a seat.
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.”