Just as they did last year, the Mets worked around a last-minute complication to swing a major deal, obtaining slugger Jay Bruce from the Reds just before Monday’s 4 p.m. non-waiver trade deadline.

Bruce, 29, is in the middle of perhaps the best season of his career. He’s hitting .265 with 25 home runs and a league-high 80 RBIs. The lefthanded hitter should add some desperately needed thump to a Mets offense that has averaged only 3.7 runs per game, third to last in the National League.

“He’s a big presence in the middle of the lineup,” Mets general manager Sandy Alderson said.

In exchange for Bruce, the Mets traded Dilson Herrera, the 22-year-old prospect who widely had been regarded as the franchise’s second baseman of the future. He was hitting .276 for Triple-A Las Vegas.

Minor-league lefty Max Wotell, 19 — who was 3-1 with a 3.94 ERA with rookie-level Kingsport — also was packaged in the deal, which had to be reconfigured two hours before the deadline.

According to sources, a review of medical records prompted the Reds to balk at the original agreement, which was headlined not by Herrera but by former first-round draft pick Brandon Nimmo.

advertisement | advertise on newsday

The setback was a flashback to last season, when medical concerns nixed a deal that would have sent Carlos Gomez from the Brewers to the Mets. The failure of that deal set the stage for the Mets to acquire the Tigers’ Yoenis Cespedes just before last year’s deadline.

This time, the Mets pressed forward and wound up with the same player they originally targeted, coming to a new agreement for Bruce about 15 minutes before the deadline.

Bruce will hit behind Cespedes, whose arrival last season jump-started the Mets’ run to the World Series. Alderson warned against harboring similar expectations for Bruce.

“It was an extraordinary turnaround last year,” he said. “All we can do is try to acquire as many good players as we can, put ourselves in position to maybe have that magic again. But I certainly think he can have an impact for us.”

The Mets also made a strong push to trade for Brewers catcher Jonathan Lucroy, with talks starting up again Monday before ultimately stalling in the afternoon, according to sources. Lucroy wound up with the Rangers.

Mets videos

“We did have quite a few conversations with them about a variety of combinations,” Alderson said. “But they felt from their point of view, for what they were looking for, they could do better elsewhere.”

A righthander to help shore up the back end of the bullpen also had been a priority. Although the Mets had talks with the Angels for Joe Smith and the Braves for Jim Johnson, they ultimately passed.

Instead, they traded one headache for the other, shipping underperforming lefty reliever Antonio Bastardo back to the Pirates for a reunion with lefthander Jonathon Niese, who will pitch out of the bullpen.

Bruce was one of the top hitters available on the trade market. Just as critical, he comes with an additional year of team control, meaning that the Mets will retain a middle-of-the-order presence even if Cespedes opts out of his contract, as he’s widely expected to do after the season.

“We would not have done the deal without the extra year of control,” Alderson said of Bruce, who is controlled via a relatively modest $13-million team option for next season. “We were not looking for a rental player.”

advertisement | advertise on newsday

Bruce was on the Mets’ radar before last season’s trade deadline, but a deal with the Reds did not materialize. This season, he isn’t a perfect fit on a team that already has a glut of lefthanded-hitting corner outfielders. Indeed, manager Terry Collins will have to do some shuffling to find a way to get Curtis Granderson and Michael Conforto playing after Bruce’s arrival.

Alderson, however, always has prioritized bolstering the offense, even at the cost of defense. Bruce is hitting .360 with runners in scoring position this season, which has been a glaring weakness for the Mets.

“All of a sudden,” Collins said, “it lengthens your lineup out.”