Yu Darvish and the Chicago Cubs are heading back to Wrigley Field feeling better about their situation than they had in several days.

Darvish on Thursday struck out a season-high 14 and allowed only two hits in six innings, as the Cubs beat the San Diego Padres 4-1 to remain tied with Milwaukee for the National League’s second wild-card spot.

“Everyone has confidence for sure,” Darvish said. “I know the last 10 days was tough, but we still have to compete each day.”

If not for two walks in the fifth inning, Darvish might have gone deeper.

“He wants to be out there,” manager Joe Maddon said. “Those couple walks, I mean, he could have got seven… But he’s uncanny coming out of his breaking ball. It’s ridiculously good, especially against left-handers.

The Padres scored in the ninth when Manny Machado was hit by a pitch with the bases loaded and two outs, but Rowan Wick struck out Luis Urias to end it.

Chicago split the four-game series and won for just the second time in seven games.

Darvish was one shy of his career high, set on Aug. 12, 2013, at Houston while he was with the Texas Rangers. He led the big leagues that year with 277 strikeouts.

Darvish said he blocked out the Cubs’ losses to the Padres the previous two nights.

“You know me, I don’t care,” he said. “I always focus to do my job and throw strikes and throw the right pitch in the right situation. That’s it.”

BREWERS 3, MARLINS 2

Ryan Braun the past two days honored injured teammate Christian Yelich by wearing his No. 22 jersey underneath his own.

He then put on a Yelich-like performance on Thursday, hitting a two-run homer that helped the Milwaukee Brewers beat the Miami Marlins 3-2 to complete a four-game sweep that extended their winning streak to seven.

“I threw up the double deuces for him,” Braun said of his message to Yelich as he crossed home plate. “He texted me: ‘It’s about time you hit a homer.’ Forty-fifth homer hit in this jersey this year.”

Milwaukee matched their longest winning streak of the season to remain tied with the Chicago Cubs. At 78-68, the Brewers are 10 games over .500 for the first time since mid-June.

“What’s within our picture is keep playing well,” Brewers manager Craig Counsell said. “The other stuff doesn’t matter right now.”

Yelich broke his right kneecap on a foul ball on Tuesday night. Before the game, the Brewers said the reigning National League MVP would not need surgery, but is done for the year.

Yelich hit .329 with 44 homers and 97 RBIs this season and also stole 30 bases. He was leading the majors in slugging percentage and on-base plus slugging when he was hurt.

Braun, bothered by a bad back for much of the season, broke a one-all tie in the third with a two-run homer off Caleb Smith (8-10).

It was Braun’s 19th home run this season and the first of his career at Marlins Park.

Gio Gonzalez and four relievers retired Miami’s final 18 batters after Lewis Brinson’s RBI single in the fourth.

Gonzalez allowed two runs and seven hits in four innings. He is 0-2 in 12 starts since beating Philadelphia on May 15.

Freddy Peralta (6-3) struck out three in two innings, and Josh Hader fanned two batters for his 31st save in 37 chances.