Wide receiver Tylan Wallace returned a punt 76 yards in overtime Sunday to give the Ravens a dramatic 37-31 victory over the Los Angeles Rams and strengthen their case for home-field advantage in the AFC playoffs.

After the offenses traded three-and-outs in overtime, Wallace — who’d replaced an injured Devin Duvernay — tiptoed down the left sideline and broke a couple of tackles as he flew to the end zone, where he was mobbed by his teammates.

The dramatic end followed a roller-coaster fourth quarter. The Ravens (10-3) took a 23-22 lead with an early field goal by kicker Justin Tucker, lost it on a touchdown pass from Matthew Stafford to former Ravens wide receiver Demarcus Robinson, regained it on a 21-yard strike from quarterback Lamar Jackson to wide receiver Zay Flowers on third-and-17, then watched the Rams (6-7) even the score at 31 on a short field goal with 11 seconds remaining.

Stafford passed for 294 yards and three touchdowns, feeding wide receivers Cooper Kupp (115 yards) and Puka Nacua (84 yards) on a down day for the Ravens’ defense.

The Baltimore Banner thanks its sponsors. Become one.

Jackson went 24-for-43 for 316 yards, three touchdowns and an interception, and added 11 carries for 70 yards. Wide receiver Odell Beckham Jr., in a reunion with the team he helped lead to the Super Bowl two seasons ago, had four catches for 97 yards and a touchdown.

While the Ravens outgained the Rams 449-410, situational football was a struggle as well. The Rams converted six of 14 third downs; the Ravens, just four of 11.

The Ravens’ hopes of claiming the AFC’s No. 1 seed jumped from about 37% to about 41%, according to The New York Times’ playoff picture. Their AFC North title odds rose from about 90% to 94%.

The Ravens started slowly and faced an early deficit, owing largely to self-inflicted woes. The Rams took a 17-14 lead midway through the third quarter on a nine-play, 75-yard touchdown drive extended by Wallace’s offside penalty on a fourth-and-5 punt. The Rams pushed their lead to 20-14 on a short field goal drive extended by a third-and-15 conversion.

In the second half, more Ravens mistakes handed the Rams another lead. After a drop on second down by tight end Isaiah Likely, center Tyler Linderbaum snapped the ball past Jackson deep in Ravens territory, leaving Jackson no choice but to kick the ball through the end zone. The Rams took a 22-20 lead on the safety midway through the third quarter.

The Baltimore Banner thanks its sponsors. Become one.

Depth comes through

The Ravens were going to have to win a playoff game like this: their defense missing for a half (and longer), their woes self-inflicted, their running game coming and going.

That the decisive margin came not from quarterback Lamar Jackson, who had another strong game in his return from the bye, or from a defense that had opportunities to put the game away late, but from wide receiver Tylan Wallace — on a punt return, no less — was just a reminder of this team’s depth and quality.

The Ravens have withstood injuries and inconsistencies on offense and defense throughout the season. Sunday, they had to deal with some questionable coaching decisions as well. But if coaching is measured by how a game’s likely contributors are prepared for its biggest moment, the Ravens’ coaches earned this 10th win.

— Jonas Shaffer, Ravens reporter

The weirdest ending of all

When Lamar Jackson chased a stray snap, he kicked it with great enthusiasm out of the end zone. He took the safety to prevent a fumble recovery for a touchdown. It was just one of the many weird moments of a messy, messy game.

The Baltimore Banner thanks its sponsors. Become one.

Jackson showed his two sides, with stretches of incredible throws paired with long stretches of severe underthrows. The defensive line put a ton of pressure on Matthew Stafford, but then it allowed the Rams to run wild. The secondary, solid through the start of the year, was picked apart. John Harbaugh threw the red flag on a play that couldn’t be challenged, losing a timeout in a close game, amid other strange calls.

But the most unexpected moment came when the special teams won the game in overtime. The weakest unit, the least consistent unit, through this game and the season, helped keep the Ravens among the top contenders in the race to win the AFC. I’d like to know who saw that coming.

— Giana Han, Ravens reporter

Plenty to clean up

Stepping aside for one second from that mind-blowing touchdown return by Tylan Wallace, the Ravens simply have to feel lucky. Their talent helped save them from a number of miscues. Lamar Jackson was sensational on the final drive of regulation, and the defense revived just in time for the extra period. Special teams redeemed an earlier miscue by Wallace himself, an offside penalty that cost the Ravens points.

This deep into the season, the Ravens still have a frustrating number of gaffes. From Tyler Linderbaum’s early snap-turned-safety to the numerous penalty flags in coverage, to the head-scratching decisions by John Harbaugh (headlined by losing a timeout on a play he couldn’t actually challenge), Baltimore looked more like a team stumbling out of training camp than one honing for the playoffs.

The Baltimore Banner thanks its sponsors. Become one.

— Kyle Goon, columnist

Tight end Isaiah Likely races in for a 54-yard touchdown to give the Ravens a 7-3 lead late in the first quarter. (Kylie Cooper)

Exorcising their demons

The Ravens tend to save their worst for last. In all three of their losses, the Ravens have held fourth-quarter leads before fumbling the game away through mismanaged drives, turnovers and defensive lapses. Several times in Sunday’s win, Baltimore seemed destined to suffer another heartbreak at the hands of an inferior opponent.

But, with a gorgeous touchdown pass to Zay Flowers in the fourth quarter, then a magical Tylan Wallace punt return score, the Ravens showed a hitherto unseen ability to squeak out a close win. It still wasn’t pretty. Baltimore’s defense allowed Los Angeles to come down the field and tie the game in the waning seconds of regulation, and the offense produced a three-and-out on its first possession of overtime. But two clutch plays were all the difference, and 10-3 is 10-3.

— Paul Mancano, audience engagement editor

This story was updated to reflect that there was no penalty against the Ravens on the play on which the Rams got a safety.