PHNOM PENH, Cambodia — After years of near total dominance in Cambodian politics, the party of Prime Minister Hun Sen won a relatively narrow victory in national elections on Sunday as a resurgent opposition rode a wave of disenchantment with the prime minister’s 28 years in power.

Khieu Kanharith, the Cambodian information minister, told news services that according to a preliminary count, the governing party won 68 seats, or about 55 percent of the National Assembly’s 123 seats. In the assembly being replaced, the governing party controlled a commanding 90 seats.

“This is a historical day, a great day for Cambodia,” Sam Rainsy, an opposition leader who returned from exile in France nine days before the election, told a news conference. “People came in great numbers to express their will and democracy seemed to move forward.”

The opposition won 55, or about 45 percent, of seats in the assembly, making it harder for Mr. Hun Sen to impose his will.