The court said Cortizo of the Democratic Revolutionary Party won 33%, with 95% of votes counted from Sunday's vote.
It said Cortizo, a cattle rancher, will formally be named president-elect on Thursday.
Cortizo said just after midnight Monday that "I call on all Panamanians to join in a national effort to correct the country's path, rescue the country and get the economy on the right track."
Second-place candidate and businessman Rómulo Roux of former President Ricardo Martinelli's Democratic Change party won 31% of the vote but has so far not concedes defeat.
The campaign focused on corruption and slowing economic growth in this Central America trade and financial hub and turned into the tightest presidential contest in recent years.
Before the announcement, Roux vowed not to concede defeat, saying the results were too close and suggesting that the race was marred by irregularities.
"We have to guarantee the protection of the electoral process and of democracy. Right now, it's in doubt," Roux said, without providing any evidence of election tampering.
The PRD, which has social-democratic leanings, will return to power for the third time since the transition to democracy three decades ago following the end of a military-led regime. The last time it in power was from 2004 through 2009 during the administration of Martín Torrijos.
There is no runoff in Panama, so the top vote-getter in the field of seven mostly business-friendly candidates wins outright and takes office July 1 for a five-year term.
Despite the scandal, Panama remains a strategic location for commerce, anchored by the heavily trafficked Panama Canal shipping route and a recently expanded international airport.
Cortizo, a 66-year-old who studied business administration in the U.S., was agriculture minister under Torrijos and campaigned on vows to clean up Panama's image after the corruption scandals.
"For Panamanians, as well as many other Latin Americans these days, corruption trumps all other issues, even inequality," said Michael Shifter, president of the Inter-American Dialogue. "In country after country in the region, people are just fed up and are demanding a real change."
Roux, a 54-year-old businessman, had the endorsement of supermarket magnate and former President Ricardo Martinelli, who is in jail awaiting trial on charges of political espionage. Roux held multiple government posts during the Martinelli administration, including minister of canal affairs and foreign minister.
Roux highlighted during his campaign that Panama's economy grew only 3.8% last year, versus a 10.7% expansion in 2012, when Martinelli was president. But Roux's association with Martinelli appeared to have hurt his bid for the presidency, said Shifter.
The top three was rounded out by an independent candidate who got on the ballot by collecting thousands of signatures. Ricardo Lombana, 45, is a lawyer who gained prominence via a citizen's movement several years ago that questioned impunity and corruption in the country. Lombana had nearly 20% of the vote.
Turnout was strong at 72% for Panama's sixth presidential election since a U.S. invasion ousted strongman Manuel Noriega in 1989.
Panamanian voters were also concerned about rising unemployment, public schools in decline, unreliable water service and insufficient garbage collection in the capital.
Outgoing President Juan Carlos Varela, a 55-year-old conservative and liquor industry veteran, was barred by the constitution from running.