Here’s the hook — the Knicks weren’t counting on much offense from Robin Lopez when they signed the 7-footer to a four-year, $54-millon contract in the summer.

But Lopez has been working on perfecting his hook shot. It’s a throwback move that doesn’t elicit oohs and ahhs like a dunk. But it’s still worth the same two points.

Lopez was the Knicks’ second-leading scorer Wednesday night in a 118-111 overtime over Utah at the Garden. He scored a season-high 22 points on 11 of 14 shooting with 12 rebounds and three blocks for his fourth double-double of the season.

“Robin was outstanding,” coach Derek Fisher said. “His presence on the floor as the season has gone on has really been instrumental in helping us get a little bit better.”

Lopez, a career 8.2-point scorer, went into the game averaging 8.6 this season. In his past 11 games, however, he has averaged 13.7 points as he’s gotten more comfortable in the Knicks’ offense.

Lopez is not supposed to be the Knicks’ second option on offense, but he was much of last night as Kristaps Porzingis scored 16 while battling a sore right foot. Before the game, Fisher said of Porzingis, “It could be a night where it’s not best to have him out there.”

advertisement | advertise on newsday

But Porzingis was out there. So was Carmelo Anthony, who scored 30 points while playing through an ankle injury.

Lopez took the Knicks’ first three shots of the game — all hook shots — and hit two of them. Both baskets were set up by passes from Anthony, who had a game-high nine assists.

Lopez, who is righthanded, also had a pretty lefthanded hook shot and a more conventional put-back in overtime.

Asked how he decides to go to the hook shot, Lopez said: “It’s how the defense is playing everybody. How they’re playing off Melo. How they’re helping. How they’re playing post defense. It’s a lot of reads.”

Anthony passing off to Lopez may not seem like the Knicks’ best offense. But team president Phil Jackson wanted a center who could fit in the triangle. Lately, Lopez has been filling that role just fine.

Knicks videos

Said Fisher: “I think as he’s gotten more comfortable as the season’s gone on, understanding where those opportunities will come from in this particular offense, I think he’s been able to find a level that he’s actually capable of sustaining.”

The Knicks only got 28 points from their bench — 19 from Derrick Williams and nine from Langston Galloway. So it was important for unexpected guys to step up and put the ball in the basket.

Even if the way Lopez puts the ball in the basket looks like it came from a 1950s highlight reel.