Hard-liners, representatives of the sharper edges of Iran’s Islamic revolutionary ideology, have long had trouble attracting a large voter base. Iranian society has changed rapidly in 15 years, with the middle classes feeling more alienated by the harsh political talk against the United States, Western culture and any form of social relaxation.

Obtaining a strong minority in Parliament is not only Mr. Rouhani’s victory but also a result of a broader trend in which the Iranian political discourse is shifting away from a polarized universe of hard-liner versus reformist. Those supporting Mr. Rouhani prefer to call themselves pragmatists, centrists and moderates.

While the victory is significant, those expecting major social change in Iran will be proved wrong, both supporters of the government and hard-liners say. Those who made it into Parliament under the banner of reforms seem mostly to be cautious politicians. The original reformist leaders, who have pleaded for radical changes in law and ideology, are either in jail or prohibited from participating in the political process.

“They will quickly face division among themselves, since the supporters of the government is a mixed bag of individuals with different political backgrounds,” said Hamidreza Taraghi, a political analyst close to Iran’s leadership. “To write off the hard-liners would be a major mistake.”

Nevertheless, it is increasingly clear that Ayatollah Khamenei is supporting the moderate trend, at least in foreign policy and on economic issues. He was the main architect of the nuclear agreement. While he continues to warn against the United States, he has allowed continuing contacts between his foreign minister, Mohammad Javad Zarif, and Secretary of State John Kerry. He also welcomes and meets with European heads of state, most recently the president of Switzerland, Johann Schneider-Ammann, on Friday, urging the Swiss to invest in Iran.

In Tehran, the epicenter of middle-class culture, Mr. Rouhani has been criticized for his failure to deliver on any of his promises of more freedom and domestic political change. But fear of another four years of hard-liners in Parliament, combined with the successful nuclear deal and the lifting of the sanctions, prompted many to come out and vote for the president and his followers.

At a polling station in Shahrak-e Gharb, in western Tehran, families joined the older men who pass the days in a neighboring park for hours of waiting before casting their ballots. “I’m not into politics,” said Reza Sharji, 35, a graphic designer with a long hipster beard. “But I do know what I don’t want, that is more hard-liners.”