SEATTLE — After weeks of mostly poor performances, Marco Estrada once again flirted with a no-hitter for Toronto.

And just when the Blue Jays needed that quality of a performance.

Estrada took a no-hitter into the seventh inning, Edwin Encarnacion hit his 41st home run and the Blue Jays beat the Seattle Mariners 3-2 on Monday night in the opener of a critical three-game series.

Estrada (9-9) had allowed only two walks before Robinson Cano led off the seventh with a line drive up the middle on a 2-1 pitch. Cano and Nelson Cruz walked in the fourth — an inning that ended on Kevin Pillar’s sliding catch to save a run — but Estrada otherwise kept the Mariners off the bases before Cano’s single.

Estrada’s outing was exactly what the slumping Blue Jays needed. They arrived in Seattle having dropped two straight and four of six, and their wild-card lead dwindled in the process. Estrada was partly to blame for the September swoon. In his previous six starts, he was 1-4 with a 7.53 ERA. In September alone, Estrada had allowed 12 earned runs in 12 2/3 innings.

But he was brilliant against the Mariners, keeping the thousands of Blue Jays fans that made the trip south from British Columbia cheering all night as Toronto pulled even with Baltimore for the first wild-card spot. Both teams are 2 ½ games clear of Detroit and three ahead of Seattle and Houston.

“I’m not really sure what’s been going on, as the game gets going I start to struggle a little bit,” Estrada said. “We looked at video and there have been little things here and there that we caught. We changed it up and felt pretty good today.”

Estrada was pulled after walking Leonys Martin leading off the eighth inning, leaving to a standing ovation from the huge Blue Jays contingent. He struck out eight and walked three before being replaced by Jason Grilli.

The final six outs were trying for the Blue Jays. Pinch-hitter Ben Gamel walked to put two runners on with no outs in the eighth, and Seth Smith walked on a nine-pitch at-bat with two outs to load the bases for Cano.

Closer Roberto Osuna entered and got Cano to line out to the warning track in right field where Ezequiel Carrera was playing. Martin hit a two-out, two-run homer in the ninth off Osuna, but Gamel struck out looking to cap Osuna’s 34th save.

“We know what’s ahead of us, and we aren’t going to back away from it,” Seattle manager Scott Servais said. “I thought our guys gave a really good effort tonight, just wasn’t enough.”

Encarnacion’s two-run homer off starter Taijuan Walker (6-11) came with two outs in the third on a 0-1 pitch that was left up in the strike zone. Pillar added a two-out RBI single in the fourth inning after Troy Tulowitzki led off with a double.

NEAR MISSES

Estrada has never completed a no-hitter, but he’s been close. He lost a no-hit bid in the eighth inning against Boston on June 5, and also pitched hitless ball into the eighth inning in consecutive starts in June 2015.

“It’s not something that I was focused on. Obviously if it would have happened it would have been incredible but it didn’t. Cano hit a pretty good pitch,” Estrada said.

DONALDSON TOSSED

Toronto’s Josh Donaldson was ejected in the seventh inning arguing with plate umpire Chris Conroy after being called out on strikes. Donaldson was already upset about a check-swing Conroy called a strike earlier in the at-bat and flipped at being called out on a fastball on the outside corner. Donaldson immediately got in Conroy’s face and was quickly tossed.

UP NEXT

Blue Jays: LHP J.A. Happ (19-4) goes for his 20th win. Happ would join Boston’s Rick Porcello as the only two pitchers in baseball with 20 wins this season. Happ has won 13 of his last 14 decisions.

Mariners: RHP Hisashi Iwakuma (16-11) looks for his third straight victory. Iwakuma allowed just one run in 6 1/3 innings in his last start against the Angels.