Kevin Durant and his Golden State Warriors moved one game closer to winning the 2017 NBA title with Wednesday’s victory in Cleveland. (Ken Blaze/USA Today Sports)

When Kevin Durant chose to join the Golden State Warriors last summer as a free agent, he cited plenty of reasons. But there was one, above all, that led to Durant leaving the Oklahoma City Thunder for the team that had ended his season: The Warriors provided him with the best chance to win a championship.

In Game 3 of the NBA Finals, with the potential for history hanging in the balance, Durant stepped forward to leave Golden State on the verge of its second title in three years, scoring seven of his 31 points during an 11-0 run over the final 3:09 to lift the Warriors to a 118-113 win and a 3-0 lead in the best-of-seven series.

The key shot in the run was a three-pointer with 45 seconds remaining that put the Warriors up 114-113.

“I been working on that shot my whole life,” said Durant, who had eight rebounds and four assists. “For that one to go in, that was liberating right there.”

Now the Warriors, who haven’t lost since April 10, will have a chance to do something no team has done: go 16-0 en route to winning a championship.

And they will have the chance to do so because of Durant, the man who has turned an already great team into arguably the greatest in NBA history — one that feels like the living embodiment of a video game cheat code.

That certainly was the case in the final minutes Wednesday. After the Cavaliers, who were led by impressive performances from LeBron James (39 points, 11 rebounds and nine assists) and Kyrie Irving (38 points), had led for the final few minutes of the third and all of the fourth, it was Durant who led the Warriors back in the final moments.

It didn’t look as if Golden State would have its shot at history after Klay Thompson, who finished with 30 points, missed a potential game-tying three-pointer. James followed by driving into the lane and kicking out to J.R. Smith for a three-pointer that made it 113-107 Cavaliers with 3:09 to play.

“It was just an incredibly tough, resilient performance,” Warriors Coach Steve Kerr said. “It wasn’t our smartest game we played all year, but it was maybe our toughest in terms of our ability to just hang in there.

“Nothing was really going our way, but we were still there, and we just had to kind of stay with it, and I thought our guys did a really good job of that.”

After Stephen Curry, who had 26 points and 13 rebounds, hit a jumper to cut Cleveland’s lead to 113-109, Durant drove into the lane and made a short jumper with 1:15 remaining.

And after Kyle Korver — one of the NBA’s best three-point shooters — missed an open corner three-pointer with 52 seconds remaining, Durant caught the ball near the top of the key and buried the game’s biggest three-pointer to make it 114-113 with 45 seconds remaining.

Said Irving: “I’ll probably be replaying that play for a while. It definitely hurts.”

The Cavaliers then had a pair of chances to tie or take the lead. But Irving missed a three-pointer, and after Curry hit a pair of free throws — and Cleveland inexplicably wasted 13 seconds before fouling — Andre Iguodala stripped James on an attempted three-pointer and then forced James to step out of bounds and turn the ball over.

That ended Cleveland’s hopes — and all but certainly ensured the Warriors will be crowned NBA champions in the coming days.

“We were up eight in the first quarter,” Durant said. “We just wanted to stay around. We just settled down and got stops in the end.”

If there was any doubt about how this game would be played, that was answered by the way both teams started. With their season on the line, the Cavaliers started the game absolutely flying around the court.

Cleveland came out making everything — hitting 11 of its 20 shots in the first quarter and getting to the line seven times — but so, too, did Golden State.

That was especially true for Thompson, whose struggles throughout these playoffs — at least up until Game 2 of the Finals — were quickly forgotten. Thompson followed up his 22-point performance in Game 2 with 16 points in the first quarter of Game 3, going 5 for 7 from the field and 4 for 5 from three-point range as the Warriors set an NBA Finals record by burying nine three-pointers in the first quarter.

That allowed Golden State to wind up leading 39-32 after one; it finished the quarter with a 10-0 run with James on the bench for the final 109 seconds. That wound up being the only time he sat in the first half. He checked back in to start the second and promptly began dragging Cleveland back into the game.

“I thought our team scrapped and competed,” Cleveland Coach Tyronn Lue said. “I can’t be disappointed with the effort and how we played, but they made the plays down the stretch that we didn’t execute defensively or offensively, and we took advantage of it.”

After losing the first two games in Oakland, Cleveland knew that its only chance of making this a competitive series would be to win Game 3 on its home court. And from the opening tip, James appeared hellbent on making sure that would happen.

He had 15 points on 7-for-8 shooting in the first quarter and finished the first half with 27 points on 11-for-14 shooting, hitting three times from behind the three-point line to go along with four rebounds and three assists.

But unlike the previous two games, he got some significant contributions from others — specifically Irving. After struggling, at least by his standards, in both games in Oakland, Irving was back to his explosive self. And after James kept Cleveland in the game with his massive first half, Irving allowed the Cavaliers to take control in the third.

Irving scored 16 points in the third quarter, going 7 for 10 from the floor on an assortment of his usual crafty drives into the lane that resulted in one contested layup after another.

After Cleveland went on a 10-0 run early in the third to take its first lead since the game’s opening minutes, Irving hit James for a dunk and then made a pair of baskets to extend Cleveland’s lead to 94-87 late in the third — its largest of the game.

It looked as if it might be enough to ensure a Cleveland victory and to give the Cavaliers new life in this series. But Durant had other ideas. And now he has moved within one win of what he came to Golden State to do: win a championship.