MEXICO CITY — Panamanians, enjoying one of the fastest-growing economies in the hemisphere but wary of corruption and growing executive power, rejected the governing party’s choice for president on Sunday — on a ticket with the president’s wife for vice president — and instead hewed to tradition by electing an opposition candidate.

Panama’s election commission declared the president-elect to be Juan Carlos Varela, who is vice president but broke with the governing party in a rancorous falling-out and was stripped of many of his duties. He captured 39 percent of the vote, with more than three-quarters of the ballots counted.

Mr. Varela, 50, an engineer and well-known politician whose family owns the country’s biggest liquor producer, was seven points ahead of the 32 percent won by the governing party candidate, José Domingo Arias, a former housing minister and a political newcomer. A third major candidate, Juan Carlos Navarro, a former two-time mayor of Panama City, had 28 percent.

Mr. Varela, who takes office on July 1 for a five-year term, campaigned against growing fears of corruption and the president’s iron fist-style of leadership. He promised a more transparent government that would maintain growth and popular social programs and fight inequality.