BALTIMORE — Just when it appeared that the Cleveland Browns were well on their way to being a bust and the Baltimore Ravens were poised to run away with the AFC North race, the Browns came to town and changed those narratives dramatically.

This wasn’t exactly the football elegance so many envisioned for the Browns when Cleveland traded for wide receiver Odell Beckham Jr. in the offseason to pair him with quarterback Baker Mayfield. But it was ruggedly effective. With Beckham serving mostly as a decoy and participating in an on-field scuffle, the Browns followed the lead of Mayfield, wideout Jarvis Landry and tailback Nick Chubb on offense and the defense mostly did its part in a 40-25 triumph Sunday at M&T Bank Stadium.

“The win’s great,” Mayfield said. “But I hope everybody keeps the same energy that threw us in the trash. We won’t forget it.”

A loss Sunday by the Browns would have dropped them to 1-3. All that hype during the offseason, training camp and preseason would have appeared decidedly misguided. They would have been, to some, those same old, pitiable Browns. They would have trailed the Ravens by two games in the division chase. The Ravens would have been the AFC North’s clear-cut team to beat, with the Pittsburgh Steelers and Cincinnati Bengals set to meet Monday night in a matchup of winless teams.

Instead, the Browns tied the Ravens for first place with matching 2-2 records. The division is back to being competitive. It’s not quite time for the Browns adulation to flow again at full force. But it can resume, within reason.

“There’s a lot of new things for this team,” Browns Coach Freddie Kitchens said. “And I just want to see improvement each and every time we come out on the field.”

Beckham was held to two catches, the first of which came midway through the fourth quarter. It was a physical, frustrating game for him in which he was blanketed by a Baltimore defense focused on stopping him.

He looked for penalty flags for defensive holding that weren’t thrown, and he was flagged for a third-quarter personal foul after a scuffle with Ravens cornerback Marlon Humphrey. Humphrey ended up on top of Beckham on the turf, with his hands at Beckham’s throat, before other players and the officials intervened. Beckham said later it was all about “just competing” and he was upset at having lost an earring. Four personal fouls were called on the play.

“I was told that Beckham took a swing at him,” Ravens Coach John Harbaugh said. “So that’s supposed to be a penalty.”

Replays showed Beckham, while trying to block and push away Humphrey, appear to jab with his right hand toward Humphrey’s helmet. But neither player was ejected following a review by the NFL’s officiating department in New York.

“We didn’t see anything on the field that rose to the level of a disqualifying foul,” referee Shawn Hochuli told a pool reporter. “When New York looked at it, they didn’t see anything either that rose to the level of a disqualifying foul.”

Humphrey said that he apologized to Beckham after the game.

With Beckham commanding so much attention, there were openings for Landry, Chubb and tight end Ricky Seals-Jones. Landry had eight catches for 167 yards before exiting the game under the NFL’s concussion protocol. Seals-Jones had three catches for 82 yards. And Chubb ran for three touchdowns, including an 88-yarder in the fourth quarter on which he went untouched.

“Anybody could have run through it,” Chubb said. “It was a pretty big hole.”

Mayfield threw for 342 yards and a touchdown in a 20-for-30 passing performance as the Browns amassed 530 yards against Baltimore’s celebrated defense. But this wasn’t about ­Mayfield-to-Beckham artistry. This was about Chubb’s 165 rushing yards and going toe-to-toe with the Ravens.

“It’s one of those things where you pick your poison of what you want to take out of our offense,” Mayfield said. “And we have to be very good at working on whatever they’re not taking out.”

Mayfield said it was “evident pretty quickly” that the Ravens would be focused on Beckham.

“But I think that’s why we played better,” Mayfield said. “We knew exactly how they were trying to attack us, and we did our job.”

Mayfield dismissed his recent Twitter feud with Antonio Brown — “If you don’t wear orange and brown, you don’t matter,” Mayfield said — and shrugged off criticism by former New York Jets coach Rex Ryan, who is now an ESPN analyst. “Rex Ryan,” he said, “does not get any credit for this week’s win.”

He also said the recent scrutiny on Kitchens’s play-calling was unnecessary.

“I played better,” Mayfield said. “It was easy on him. Anytime the quarterback sucks, it’s probably pretty hard to call plays.”

Ravens quarterback Lamar Jackson threw for three touchdowns in a 24-for-34, 247-yard passing day and also ran for 66 yards. But the Browns had two interceptions and sacked Jackson four times. The Ravens have two straight losses after a 2-0 start and now must settle in for a heated division race.

“They played the better football today,” Harbaugh said of the Browns, “by a large margin.”