By Alexandra Alper SAN JOSE, Feb 2 (Reuters) - A left-leaning former diplomat edged ahead in Costa Rica's presidential election on Sunday, riding a wave of disgust at government corruption to get within reach of wresting power from the centrist government in an April run-off. Luis Guillermo Solis, an academic who has never been elected to office, had a slim lead over ruling party candidate Johnny Araya despite trailing in pre-election polls and early vote returns. Araya was seen as the front-runner ahead of the vote, but his campaign was hurt by corruption scandals that plagued President Laura Chinchilla's administration. Solis, who ran on an anti-corruption ticket, won 30.9 percent support on Sunday compared to 29.6 percent for Araya with returns in from around 82 percent of polling centers. Left-wing lawmaker Jose Maria Villalta was in third place with 17.2 percent. His supporters could help carry Solis to victory in the run-off against Araya, although votes from a host of smaller parties who commanded around a quarter of the tally on Sunday will also be fought over. A Solis victory in the run-off would mark another triumph for center-left parties which have gained ground in much of Latin America in recent years. "Costa Rica's time has come," Solis said with a wry expression as his supporters cheered to the blare of music on Sunday night. "From coast to coast, the rising wave has become a great tsunami that has washed away traditional politics forever." Araya, 56, promised to reduce poverty and painted his leftist rivals as radicals who are a threat to Central America's second-largest economy. "We represent the safe road, the responsible road, to maintain political, economic and social stability in Costa Rica," Araya told flag-waving supporters of his National Liberation Party after vote returns showed him losing his early lead. Voter anger over government corruption buoyed his left-leaning rivals, who also promised to tackle inequality in the coffee-producing nation. Gaffes during the campaign, such as underestimating the price of milk in an interview, distanced Araya from some voters. A prosecutor's probe into allegations of abuse of authority and embezzlement while Araya was mayor of San Jose also dampened his appeal. Solis, who cut his teeth working in Costa Rica's foreign ministry, surged late in the campaign by pledging to improve infrastructure, overhaul the country's universal health care provider and stamp out corruption. That resonated with some voters after Chinchilla sparked outrage by accepting flights on a private jet, despite laws barring public officials from accepting sizeable gifts. "The National Liberation Party has been in power for eight years, and if it has stood out for anything, it has been its extreme corruption," said Eduardo Solano, 23, a union legal advisor. The eventual winner will have to tackle growing government debt that totals more than half of gross domestic product. "If they don't do something, then this somewhat negative trend on the debt could continue and that could have an impact on the credit rating," said Joydeep Mukherji, a sovereign credit analyst with Standard & Poor's, which rates Costa Rica at BB with a stable outlook.