Brock Boeser and Jay Beagle scored late in Vancouver’s three-goal first period and the Canucks held on to beat the New York Rangers 3-2 on Sunday.

Bo Horvat also scored and Elias Pettersson had two assists for Vancouver, which bounced back from a 1-0 loss at New Jersey on Saturday to win for the fifth time in six games. Jacob Markstrom stopped 38 shots to win his third straight start after losing his first two.

Jesper Fast had a goal and an assist, and Artemi Panarin also scored for New York, which has lost four straight — including three in four days after playing just three times in the previous 14 days. Henrik Lundqvist finished with 40 saves.

Rangers coach David Quinn shook up his lineup during Friday’s 5-2 loss at Washington, moving Chris Kreider to the top line with Artemi Panarin and Mika Zibanejad. Pavel Buchnevich was dropped to the second line, and rookie Kaapo Kakko down to the third. Buchnevich ended up on the fourth line during the second period but was back on the second later in the game.

Down 3-1 after 40 minutes, the Rangers came out aggressive in the third and controlled much of the play while outshooting the Canucks 17-6 in the final period.

Panarin got the Rangers to 3-2 as he got a pass from Fast from behind the net, and quickly put it past Markstrom for his fourth at 5:31.

New York had several flurries of chances at the tying goal, pulling Lundqvist for an extra skater with 1:51 to go, but couldn’t get another one past Markstrom.

The Rangers finished 0 for 3 on the power play to fall to 1 for 17 with the man-advantage over the last four games.

With the Rangers trailing 3-0 after a lackluster first period, Fast got them on the scoreboard late in the second. Standing in front of Markstrom, Fast deflected Jacob Trouba’s hard point shot past the goalie for his second.

After making 17 saves in the first, Lundqvist stopped all 17 shots he faced in the middle period to keep the Canucks at bay.

The Canucks got off to a fast start with three goals in the first period while outshooting the Rangers 20-13. Vancouver scored on the power play, at even strength and short-handed.

Horvat got things started as he took a pass from Pettersson and beat Lundqvist on a power play from the inside edge of the left circle for his second of the season and 100th of his career at 6:01. The Canucks came in with the league’s worst man-advantage and were 0 for 12 the previous two games.

Boeser made it 2-0 with 6:26 left in the opening period as he got a pass from Pettersson between the circles and fired a shot that went off Lundqvist’s glove and in for his second.

Then, with Tyler Myers off for hooking, Beagle brought the puck up the right side and beat Lundqvist on the glove side for his first of the season and fourth career short-handed goal.