INDIANAPOLIS (AP) — Pato O’Ward sat on the pit road wall while an Indianapolis 500 championship celebration for one of IndyCar's aging stars raged behind him, and he took a handshake from another veteran Indy winner on a job well done.

In the battle of youth vs. experience, score one for the old guys.

O’Ward, a budding 22-year-old star, and Álex Palou, just 24, figure to be in the mix at Indianapolis Motor Speedway for decades to come. But they both frittered away leads throughout the race and failed to kiss the bricks at Indy on Sunday.

That honor went to 46-year-old Helio Castroneves, who won his record-tying fourth Indy 500 when he passed Palou for good with two laps left and beat him by 0.4928 seconds for the victory.

“It hurts. It hurts a lot. I didn’t expect a second place to hurt that much,” Palou said.

O’Ward, a Mexican who rose to popularity with Arrow McLaren SP and was teammates in Indy with two-time race winner Juan Pablo Montoya, led 17 laps and finished fourth -- one spot behind 2019 winner Simon Pagenaud, who offered his hand and a pep talk after the race.

“I felt like we had a very competitive car, a car that for sure could have won the race,” O’Ward said. “I didn’t have enough for them. I didn’t have enough speed.”

The Indy 500 was seen as a race that could represent a true changing of the guard in the series. Through the first five races of the season, four of the winners were 24 years or younger. Three were first-time winners and Scott Dixon was the only veteran so far with a victory.

Castroneves made it two with his slice of Indy history. He joined A.J. Foyt, Al Unser Sr. and Rick Mears as the only four-time Indy 500 champions.

“I don’t know why, he had three. Why he wanted four, he could have gave me one,” Palou said, smiling. “I just wanted one. It’s OK. We come back next year, for sure.”

O’Ward said he simply didn’t have enough speed in the No. 5 Chevrolet at the end to make a serious run at Castroneves.

“I knew once we got up front, I could get the job done,” he said. “I knew we were in the fight.”

Castroneves, Pagenaud, Ed Carpenter, Montoya and 2013 champ Tony Kanaan all are at least 37 years old and finished in the top 10.

“This shows it’s about experience and knowledge and I’m glad that’s the case,” Pagenaud said.

Castroneves, who has three runner-up finishes at Indy, said Palou “had a great car and did everything he possibly could. Last year, he didn't finish. This year he finished second, so that's a big improvement.”

Pagenaud said Palou “showed his hand” too early in how he was going to wrest the win from Castroneves.

“He was trying to find ways to keep Helio behind but there were too many laps to go,” Pagenaud said. “Helio was just waiting in the back. He was keeping Pato behind, judging the timing. He knew exactly where he could get him and when he could get him. All of a sudden, you saw him jump at his throat like a tiger."

Palou led 35 laps, behind only Conor Daly for most in the race. Rinus VeeKay, at 20 the youngest front-row starter in race history, led 32 laps and finished eighth.

Palou, who drives for Chip Ganassi Racing, is still trying to become the first Spaniard to win the Indy 500.

“I'm starting sixth, I'm driving the No. 10 and I'm here in America,” he said. “I'm having a blast and I'm just super-proud of what we're doing.”