SACRAMENTO, Calif. -- When Gordon Hayward fouled Buddy Hield on a 3-pointer with 7.6 seconds remaining in Wednesday night's game between the Boston Celtics and Sacramento Kings, he was afraid he'd cost his team the game.

He then made sure that he hadn't.

After Hield made all three free throws to tie the score, Hayward took the inbounds pass, drove the length of the court and hit a tough fallaway jumper over Hield's outstretched arm with 2 seconds remaining to lift the Celtics to a 111-109 victory over the Kings at Golden 1 Center.

"I just had to get it up the length of the court," Hayward said. "I was able to finish the play off, but really just making a play."

He certainly did that, as his twisting, fadeaway bucket put a dagger in the Kings (32-32), who are trying to make the playoffs for the first time since 2006. The loss dropped Sacramento four full games behind the LA Clippers and San Antonio Spurs for the final playoff spot.

The Kings have lost six of their past eight games, including three losses by two points (to Boston, the Golden State Warriors and Denver Nuggets) and one in overtime (to the Milwaukee Bucks).

"I'm tired of that s---," said Hield, who scored 23 points. "It's life in the NBA, man. It's hard to win basketball games -- especially against good teams."

Boston (40-26) hasn't always looked like a good team this season, but Wednesday's win came on the heels of an emphatic 33-point victory over the Warriors on Tuesday -- which could be a sign that better days lie ahead for the Celtics.

Both Hayward and Celtics coach Brad Stevens said after Tuesday's win that it would require another great effort to beat Sacramento. Sacramento shot 50 percent from the field and 13-for-29 (44.8 percent) from 3-point range to stay in the game and kept the contest close throughout the fourth quarter until Hield's free throws tied things up with 7.6 seconds left.

Boston didn't have a timeout left, and with Kyrie Irving sitting out with a left thigh contusion, Hayward was the one to take the inbounds pass, bring the ball up the court and -- when the rest of Sacramento's defenders stayed home -- went at Hield for what wound up being the game-winning shot.

"You look at the film and you always ... when you watch something, you always say, 'I should have done this, I should have done that.' He made a fallaway fadeaway," Hield said. "There's nothing much you can do about that. I contested it. It's not like I didn't contest it. You say pressure him, but sometimes you don't want to pressure guys way up because they have the lane to go drive full court. I don't care who you are, you can't guard nobody full court. I don't care what fan thinks they can come out here and guard somebody full court. They can't.

"You can pick and choose your poison. I tried to make it as tough as possible. I could've been more aggressive, but he made a tough fadeaway jump shot. Great shot, and hats off to him. It's a great story for him, the way he's battled [back] from injury, and so you have to tip your hat to that. Sometimes that's how it's going to work."

After scoring 30 points in Tuesday's demolition of Golden State, Hayward finished with 12 points and 5 assists Wednesday night. Hayward's 6-for-10 shooting performance against Sacramento meant that Boston is now 19-2 this season when he hits at least 50 percent of his shots and 17-22 when he does not.

"I think it builds a little bit of confidence, try to keep the good games going, be more consistent," Hayward said. "I felt like tonight wasn't my best night shooting-wise, but I try to do some other things. They were a tough team, and I think the fact that they push the ball so fast up the court was even harder on us coming from a back-to-back, so I'm proud of us that we gutted it out."

One person who isn't going to be speaking any more about Hayward's confidence level is Stevens. When he was asked about it early in his postgame news conference, Stevens said it would be the final time he'd address the topic after doing so repeatedly over the past several months any time Hayward either played very well or very poorly.

"I mean, he should have plenty of confidence," Stevens said. "He's a heck of a player, and we all believe in him. So I'll probably stop talking about working his way back and just call him Gordon and try to help move forward here, because he's obviously played great these two nights, and these are two really good wins, really hard wins."