INDIANAPOLIS — Boston’s plan was simple: Foul quickly and send the Pacers to the free throw line.

But trailing by one with seconds ticking away, the Celtics didn’t get the whistle they wanted.

Instead, they got the steal they needed.

Terry Rozier turned it into a go-ahead dunk with 1.5 seconds remaining and gave the Celtics a 112-111 victory over Indiana on Monday night.

Following an inbound pass with nine seconds left, Boston was attempting to trap Indiana’s Bojan Bogdanovic along the sideline. With 4.3 seconds left, Bogdanovic, who would have almost certainly been fouled had he simply held onto the ball, threw a high pass intended for Victor Oladipo near midcourt. Rozier intercepted it and had an open court to his game-winning slam.

“Kyrie (Irving) and Marcus (Smart) had the first trap and Marcus was trying to yell to the referee, ‘I’m fouling, I’m fouling!’ but they didn’t call it. Then they threw the ball to Bogdanovic and he made the pass and I was able to get my hand on it,” Rozier said. “As soon as I stole the ball I took a look at the clock and saw there were four seconds and I knew I had time.”

Irving scored 30 points for Boston, which trailed 107-102 after Oladipo’s basket with 31 seconds remaining. Irving made a pair of 3-pointers in the final 30 seconds to keep the Celtics within striking distance.

“That was one hell of a game to be a part of,” Irving said.

Al Horford had 14 points, 10 rebounds and nine assists for the Celtics. Jayson Tatum added 16 points and Smart had 15.

Oladipo scored 12 of his 38 points in the final two minutes. With less than a minute remaining, Oladipo hit a 3-pointer that gave Indiana its first lead of the game and a layup that stretched the Pacers’ lead to 107-102 with 31 seconds left.

Boston began the game with a dominant first quarter, making its first 10 shot attempts, jumping out to a 12-0 lead. The Celtics led by as many as 18 points in the first quarter and went into halftime leading 62-47.

The Pacers cut the deficit to single digits in the third quarter and rallied late in the fourth.

Darren Collison finished with 15 points and Domantas Sabonis scored 18 points and grabbed seven rebounds.

“It’s a tough loss. It’s a tough, tough loss,” Oladipo said. “We’ve got to have a better start. It was just a crazy game. We dug ourselves the deepest hole you can imagine and again, fought our way back like clockwork, but we come up short again. We gave ourselves a chance and we competed with the best team in the Eastern Conference. We just have to continue to get better.”