FOXBORO (CBS) — The Patriots were not supposed to win on Sunday night. After four straight losses and a much-too-narrow win over the Jets, the Patriots were trending downward, and they were rightfully pinned as big underdogs at home against the 6-2 Ravens.

Yet the world certainly should know by now that no matter the opponent and no matter the circumstance, Bill Belichick’s team should never be outright dismissed.

READ MORE: Boil Water Order Rescinded In Burlington 2 Days After E. Coli Found

The Patriots played tremendous complementary football for 60 minutes, beating the Ravens 23-17 on Sunday Night Football.

The win improves the Patriots to 4-5 on the season.

Cam Newton completed 13 of 17 passes for 118 yards and a touchdown, while also rushing for 21 yards and a touchdown on 11 carries. Lamar Jackson was 24-for-34 for 249 yards with two touchdowns and an interception. He rushed for 55 yards on 11 carries.

Damien Harris rushed for 121 yards on 22 carries, while Jakobi Meyers was the Patriots’ leading receiver, with five receptions for 59 yards. Meyers also threw a touchdown to Rex Burkhead on a trick play. That was Burkhead’s second touchdown reception of the night.

This one came down to the final moments, as the Ravens gained possession at their own 22-yard line while trailing by six points with 1:05 left in the fourth quarter. With an absolute downpour falling, Lamar Jackson was unable to engineer the game-winning drive. Kyle Dugger tackled J.K. Dobbins in bounds with 20 seconds left, all but ending the game. Jackson’s final pass was dropped on fourth down, and Cam Newton came on to take a knee and complete the victory.

The Patriots began the game with a defensive stop, before driving to the Baltimore 34-yard line. But on third-and-6, Mike Onwenu got beaten by Matthew Judon on a speed rush, and Judon sacked Newton, taking the Patriots out of field goal range.

The Ravens took over at their own 6-yard line and then mounted a 13-play, 94 yard touchdown drive. Willie Snead took a quick pass in the backfield on a jet sweep and ran around the right end and into the end zone for the first points of the game on the first snap of the second quarter. The scoring drive took 8:04 off the clock.

New England answered, though, with a quick-strike 75-yard touchdown drive in 3:08. That drive began with a 19-yard connection from Newton to Jakobi Meyers, with a 15-yard penalty tacked on for DeShon Elliott. Newton hit Ryan Izzo for a 20-yard catch-and-run later in the drive, and Rex Burkhead caught a pass out of the backfield and made a dive for the right pylon to get the Patriots on the board. Nick Folk’s extra point tied the game at 7-7.

The Ravens then went on yet another long drive, this time marching 69 yards on 11 plays. But the Patriots’ defense came up with a third-and-goal stop from the 6-yard line, forcing Baltimore to settle for a Justin Tucker chip shot to make the score 10-7.

But the Patriots — who entered the game as seven-point underdogs — showed some tremendous fight. With a heavy dose of Damien Harris, the Patriots drove to the Baltimore 24-yard line before calling timeout. Coming out of that timeout, the offense pulled off a trick play, with Newton throwing a backward pass to Jakobi Meyers, who then lobbed a pass to the end zone for Burkhead. The running back hauled it in, and the Patriots led, 13-10. (Folk’s PAT was no good.)

The Patriots kept that lead intact when J.C. Jackson picked off Lamar Jackson before halftime. And coming out of the half, the Patriots again leaned on Harris to move them up the field. This time, a designed run to the right side for Newton was perfectly executed in the red zone, and the QB scampered into the end zone with his ninth rushing touchdown of the season to give the Patriots a 20-10 lead.

That 75-yard drive required just four plays and took just 1:43 off the clock.

The Ravens went for it on a fourth-and-1 on the ensuing drive, but a bad snap to Mark Ingram in the Wildcat formation led to a big loss and a turnover on downs. New England drove it deep into Baltimore territory, but Newton threw short of Meyers on third-and-goal, leading to a short Folk field goal to stretch the lead to 23-10.

Patriots safety Kyle Dugger nearly had an interception on Baltimore’s next drive, but officials ruled that tight end Mark Andrews had made the catch and was down by contact prior to Dugger gaining possession. The Ravens made the most of that call, with Jackson hitting Snead for an 18-yard touchdown to cut the Patriots’ lead to 23-17 just before the end of the third quarter.

The teams then exchanged punts for the remainder of the fourth quarter, before the Patriots drained the clock down to 1:05.

MORE NEWS: UMass To Unveil Statues Of Erving, Camby, Leaman And Calipari

The Patriots will be heading to Houston next week to face the 2-7 Texans.