Most expensive car ever auctioned is sold for $34.65 million

The $500 million car auction
The $500 million car auction

A 52-year-old Ferrari just smashed the record for the most expensive car ever sold at auction.

The 1962 Ferrari 250 GTO, with a somewhat dark past, was just sold by Bonhams for $34.65 million. That blew away the previous record, held by a Mercedes-Benz racer that sold last summer for $31.6 million including auction fees.

"The market right now is just so strong," said Marcel Massini, a leading Ferrari historian and adviser to collectors. "And this is one of the big prizes in the entire collecting world."

Ferrari 250 GTO Berlinetta.
Source: Bonhams

Ferrari GTOs are among the holy grails of the car auction world. Ferrari made only 36 of them (or 39 if you include different versions), and they were the dominant race cars of the mid-1960s.

GTOs rarely come up for sale, and when they do they often trade in secret, private sales that can rarely be verified. Last year, a GTO sold in a private sale for $52 million, experts said. But it's been over a decade since a GTO has been sold at a public auction. While many types of high-end collecting cars have gone up in value in recent years, GTOs are now in class by themselves. Just 10 years ago, GTOs were selling for around $10 million.

Read MoreNoooo! Experts say $63 million Ferrari is a fake!

The GTO sold by Bonhams was the 19th made by Ferrari and was delivered in 1962 to a French racing driver named Jo Schlesser. The car came in second in the 1962 Tour de France.

Yet the same year, it crashed during a race at Montlhéry, near Paris. The driver, Henri Oreiller, was killed in the crash. That made the car the only GTO to be involved in a fatal crash, which some predicted could affect its sale price.

Read MoreThe super toys of the super (self-made) rich

But its later life added to its value. After the crash and repairs, it was purchased by Fabrizio Violati, an Italian car buff and heir to an Italian mineral-water business. Violati raced the car in European mountain-climb events and classic-car challenges throughout Europe until the 2000s. It became one of the centerpieces of his famed Ferrari museum—known as the Maranello Rosso Collection—in San Marino. Remaining with such a well-known owner for 49 years enhanced the car's prestige.

Read MoreArab supercars back on London's luxe streets

Violati passed away in 2010, and his family recently sold the collection to a group of investors for more than $100 million, according to people familiar with the deal. Those investors sold the GTO along with several other Violati Ferraris through Bonhams.

The auction is just one event taking place during the Pebble Beach Concourse d'Elegance.

—By CNBC's Robert Frank.