Helio Castroneves celebrates after winning his third Indianapolis 500 at Indianapolis Motor Speedway in Indianapolis on Sunday.

INDIANAPOLIS — The tears flowed as soon as Helio Castroneves turned his red-and-white car into Victory Lane, and he really got emotional when Roger Penske leaned over to give his driver a hug.

“Thanks for giving my life back,” Castroneves said between sobs.

He could’ve lost it all. He could’ve gone to prison for six years. Instead, he was celebrating another win at the Indianapolis 500.

Castroneves capped a perfect month of May by winning at the Brickyard for the third time Sunday, a triumph that was especially poignant given what he was facing just 5 1/2 weeks ago.

From accused tax cheat to Indy champion — this race was a lot longer than 500 miles.

“Let’s celebrate now!” he screamed to the quarter of a million fans.

Castroneves became the ninth driver to win the historic race three times, and his timing couldn’t have been better. On April 17, he was acquitted of most charges at a federal tax evasion trial, and the remaining count was finally thrown out last Friday.

“This is the best month of May ever,” Castroneves said, and it was hard to argue otherwise.

He won the pole. Then he won the pit-stop competition. And now, the biggest win of all, No. 3 for the guy who drives car No. 3, leaving him only one win away from joining the most elite group of all: four-time Indy winners A.J. Foyt, Al Unser and Rick Mears.

For Penske, it was Indy win No. 15 — more than any other car owner and ensuring that the Captain has never gone more than three years between wins at this place, except for the time he didn’t run because of a split in open-wheel racing.

“He smiles only two times: on his birthday and when he wins the Indy 500,” Castroneves said.

Castroneves pulled away over the final laps to beat Dan Wheldon and Danica Patrick, who eclipsed her historic fourth-place finish as a rookie in 2005 by crossing the strip of bricks in third.

Patrick, however, was never really a factor on this day.

Neither were Paul Tracy of Toronto, who was ninth, and Alex Tagliani of Lachenaie, Que., who finished 11th.

“The car was understeering the whole day and I could never really get close to guys in traffic,” said Tracy, who has been without a full-time ride since the open-wheel series’ merger last year.

“But, it’s great to be back out there. It was great to run with the top 10 guys all day but you know, I just wish we did a little bit better.”

Tagliani, making his first appearance at the Indianapolis 500, started the race in last place and was pleased with his finish.

“It was my first time here on race day and it was quite unbelievable,” said Tagliani. I“I’m very, very happy that I had a chance to participate in this race.”

The day belonged to Castroneves, who pumped his fist all the way down the final straightaway.

“I want to climb the fence,” said the driver known as “Spiderman,” referring to his signature celebration.

Then he did just that, climbing out of his car after the victory lap and scaling the fence along the main grandstand with his pit crew. Someone tossed him a green-and-yellow Brazilian flag.

It was clearly a popular victory. The fans who turned out on a sweltering late spring day were on their feet, cheering and waving their caps as Castroneves sped around the 2.5-mile oval for the final time.

Crashes took out some of the biggest names in the field, including Tony Kanaan, Marco Andretti and Graham Rahal. The most frightening wreck occurred on lap 173, when Brazilians Vitor Meira and Raphael Matos got together going into the first turn.

Meira’s car veered head-on into the padded outside wall. He was removed from the car, put on a stretcher and taken to a nearby hospital complaining of severe lower-back pain. Later, IndyCar officials said he sustained two broken vertebrae in his back, but the injury should be treatable without surgery.

The lengthy caution period after the Meira-Matos crash ensured that everyone had enough fuel to get to the finish. When the race restarted with 17 laps to go, Castroneves got a great jump on Wheldon and Patrick and pulled away to win by nearly two seconds, more than two football fields.

“At the end, I just didn’t have enough for Helio,” said Wheldon, who won the race in 2005.

Rounding out the top 10 were Ed Carpenter in eighth, Tracy and Hideki Mutoh. Tracy was racing at Indy for the first time since the disputed 2002 event, when a late caution froze the field just as he was going past Castroneves. The outspoken Canadian is still convinced he won that race — his appeal was turned down — but there was no doubt about this one.