It could have been the heads-up pennies or the four-leaf clover avatar on the Phillies’ official Twitter page. Or Gabe Kapler’s lucky T-shirt and Brad Miller’s bamboo plant. Or the curveball machine.

Yeah, it had to be the curveball machine.

Whatever the reason, the Phillies offense finally broke out Monday night in a way that was three weeks overdue.

Jean Segura had four hits, including a home run. Rhys Hoskins, Maikel Franco, and Jay Bruce went deep, too. Bryce Harper notched two RBI doubles. The Phillies piled up a season-high 19 hits and mashed in the manner in which general manager Matt Klentak intended when he put them together.

And at long, long last, they won. The Phillies throttled the New York Mets, 13-7, in the opener of a four-game series at Citizens Bank Park and snapped a seven-game losing streak that had Klentak answering questions before the game about Kapler’s job security and whether the team will act as a buyer or a seller at the trade deadline in five weeks.

“We know what kind of team we are. We know what we can do,” Harper said. “It’s just staying focused and doing those things, staying positive. Come off a sweep like that [against the Miami Marlins] and the last seven days, to win tonight was big for us.”

Or as pitcher Zach Eflin put it, “We needed a game like that.”

Indeed, Harry Kalas’ rendition of “High Hopes” played on Phanavision after the final out, but for one night, the “Hallelujah Chorus” might have been the more appropriate selection. Not only did the Phillies pick up their first win since June 15, they gained a game on the division-leading Atlanta Braves, who lost in Chicago.

Desperate to change their fortunes, the Phillies resorted to superstition. Kapler dug out a blue “Fightin’ Phils” T-shirt and wore it before the game. Miller, a utility infielder who had experienced one win since being acquired in a June 13 trade, brought in his lucky plant.

And in a more practical approach, Kapler held to his promise of breaking out the curveball machine for struggling hitters to use before the game in an attempt to simplify things at the plate, a practice employed by leadoff man Andrew McCutchen last month before he was lost for the season to a knee injury.

“One thing that we’re implementing now is a very simple approach of staying on the fastball, hitting the fastball,” Kapler said. “We know that hanging breaking balls you don’t have to sit on. You don’t have to look for them or try to hit them. They sit up there. They spin. You can be on the fastball and blister a breaking ball.”

On cue, Segura hit a curveball from Mets lefty Steven Matz for a homer in the first inning. Two batters later, Hoskins crushed a changeup. Harper pounced on sinkers in the second and fourth innings, the first time since May 30 that he had two extra-base hits in a game.

“It’s been frustrating. It’s been tough,” Segura said of a widespread slump that had the Phillies batting .222 and slugging .396 over the previous 22 games. “When you’re losing games it just [stinks]. When you’re losing games it’s no fun.”

Games like this, on the other hand, well, they’re fun even for Eflin, who was unable to hold a 4-2 lead in the third inning or a 5-4 lead in the fifth.

The offense was relentless, though. With the Phillies trailing, 6-5, in the fifth inning, Franco unloaded on a 3-0 sinker from Matz for a two-run homer, one of three hits for the slumping third baseman. And the Phillies broke open the game with four runs in a sixth-inning rally keyed by Franco’s RBI single and a pinch-hit two-run homer by Bruce.

“We executed on our game plan to keep things light today and to come in with a little swagger,” Kapler said. “Sometimes the swagger pregame leads to a swagger in game. I think we got some of that back tonight.”

Franco, in particular, entered having posted an impossibly low .445 on-base-plus-slugging percentage since April 27 and lost playing time at third base. But he has made a habit in the past of coming alive after being benched. It was last June 23 when he went 4-for-4 in a rare start at Washington and began a 34-game stretch in which he slashed .342/.388/.633 with nine homers.

Think of what a roll like that would mean to the Phillies now.

“We need this guy,” Segura said. “We’re a different type of team when we have him. Maikey can change the dynamic of the game with one swing of the bat. You guys saw it today. To have him next to me and have him in the lineup is huge for us.”

Almost as meaningful as four-leaf clovers, lucky T-shirts and a curveball machine.

Get insights on the Phillies delivered straight to your inbox with Extra Innings, our newsletter for Phillies fans by Matt Breen, Bob Brookover and Scott Lauber. Click here to sign up.