By Alan Baldwin

RIO DE JANEIRO (Reuters) - Leonidas of Rhodes would recognize a kindred spirit in Michael Phelps of Baltimore.

After 2,160 years of history, give or take a decade, the greatest athlete of ancient Greece is no longer alone on his pedestal.

The medal machine that is Phelps on Tuesday matched what must surely rank as the oldest record in sport when he chalked up his 12th individual Olympic swimming gold medal.

Leonidas, a runner who competed between 164 and 152 BC according to Olympic historians, is the only other athlete to have won 12 solo titles.

There is plenty of documentary evidence to attest to the dominance of Phelps, winner of a record 21 golds and 25 medals in an astonishing career spanning five Games that is far from finished.

The achievements of Leonidas rely on somewhat sketchier accounts, provided much later by Philostratus the Athenian and Pausanias who hailed the runner's 12 victories through four Olympiads.

The sentiments expressed by Phelps in the early hours of Wednesday after winning the 200m butterfly title would surely have resonated with Leonidas, even if the Greek had to compete with a shield and helmet.

"That's a lot of medals," grinned the American. "We got a lot of medals. It's just insane. It's mind-blowing."

Phelps has by far the most of any Olympic athlete and is the only one to win eight golds at a single Games, an achievement that earned much fanfare plus a $1 million bonus in Beijing in 2008.

In Rio, he has so far taken three golds - one individual and two relays - and on Thursday he could become the first swimmer to win the same event, the 200m individual medley, at four successive Games.

Tuesday's 200m butterfly gold made him the oldest swimmer to win an individual Olympic title at 31 years and 40 days.

Put into perspective, if Phelps were a sovereign state he would rank 52nd in the all-time lists in terms of total medals won. On golds alone, he would be in the top 40.

India, a nation of a billion people, has competed at every Olympics since 1920 and only ever won nine golds, with not even a medal in swimming.

Mexico and Indonesia, two more of the world's most populous nations, have just 19 golds between them.

Phelps has won more golds in the pool than China's men and women combined, and he has not finished yet.

"He is just proving he is easily the greatest swimmer of all time and I am excited to see what he does next because once that guy gets hot you can’t really stop him," said relay team mate Conor Dwyer.

(Reporting by Alan Baldwin Editing by Alison Williams)