LOS ANGELES — Down three runs after five innings, the Los Angeles Dodgers weren’t worried. They rarely are these days.

Yasmani Grandal homered twice, including a grand slam in the seventh inning, to rally them past the Colorado Rockies 7-4 on Thursday night.

“We always believe we’re going to win and that belief comes because we’ve done it before,” Dodgers manager Dave Roberts said.

Their 50th home victory reduced the Dodgers’ magic number for clinching their record fourth consecutive NL West title to four. Their division lead remained at six games after San Francisco beat San Diego 2-1.

“Let’s get this thing over,” said Grandal, who was 4 for 4. “Let’s clinch this and win the division.”

Luis Avilan (3-0) got the win in relief, pitching a scoreless seventh with one strikeout.

Kenley Jansen retired the side in the ninth for his 46th save in 52 chances.

“It’s probably the most resilient team I’ve been on,” Dodgers starter Brett Anderson said. “We’re never out of it.”

Rockies starter Tyler Chatwood, who came in with a 7-1 road record, pitched Colorado to a 4-2 lead before leaving after six innings. Then the Rockies’ bullpen imploded.

Jordan Lyles gave up a ground-rule, pinch-hit double to Andre Ethier to open the seventh. Boone Logan (2-4) took over and loaded the bases on two consecutive one-out walks. He then walked Adrian Gonzalez, forcing in a run and leaving the Dodgers trailing 4-3.

Grandal followed with his second career grand slam, sending a 2-2 pitch into center field and giving the Dodgers their first lead of the game, 7-4.

Logan gave up four runs and one hit in one inning, walked three and struck out none.

“We haven’t seen that from Boone all season,” Colorado manager Walt Weiss said.

Grandal hit a solo shot in the second for the sixth homer given up by Chatwood in his last four games.

Weiss and third baseman Nolan Arenado were ejected in the seventh for arguing balls and strikes. Carlos Gonzalez lined into an unassisted double play at first base, where DJ LeMahieu was doubled off to end the inning.

Making his first start since Aug. 20, Anderson gave up four runs and six hits in five innings. The left-hander struck out two and walked one after coming off the disabled list with a blister on his left index finger.

“It’s finally good not to be a full detriment to the team,” Anderson said. “I feel good and my body feels good. I kind of look at this as my first actual start with everything being OK.”

The Rockies took an early 2-0 lead on an error by right fielder Josh Reddick and Daniel Descalso’s sacrifice fly.

LeMahieu extended his consecutive on-base streak to 38 games with a homer in the fifth, extending Colorado’s lead to 4-1.

TRAINER’S ROOM

Rockies: 1B Gerardo Parra was scratched an hour before the game because of illness and was replaced by Stephen Cardullo. … 3B coach Stu Cole, hit by a ball during batting practice on Tuesday and taken to a Denver hospital, was back on the field Friday.

WHAT A PLAY

Chase Utley made an amazing play on Chatwood’s groundout to second base in the fourth. Utley went to field the ball and it escaped his glove as he spun around. Utley somehow grabbed the ball and flipped it with his right hand and his back turned toward first base, where Adrian Gonzalez was fully stretched to make the play that ended the inning.

“The legacy of Chase continues to grow,” Roberts said. “He makes this crazy no-look pass to first base. He said, ‘I can’t believe I missed the ball.'”

Utley called the play “pretty lucky.”

VISITING VIN

It was Weiss’ turn to visit Vin Scully. The team presented the 88-year-old Hall of Fame broadcaster with the letters ‘LAD’ from the Rockies scoreboard.

“His intellect and recall of the game is amazing,” Weiss said. “I didn’t even think he would know who I was, but he knew everybody, even the guys who weren’t in jersey.”

Weiss played shortstop for Oakland against the Dodgers in the 1988 World Series. He told Scully he still has nightmares when he hears the call from Game 1 in which hobbled Dodgers pinch-hitter Kirk Gibson slugged the winning home run.

“Vin told me Gibson’s home run was the most theatrical,” Weiss said, “and that (Hank) Aaron’s home run was the biggest moment of his career.”

HAPPY BIRTHDAY

Former Dodgers manager Tom Lasorda celebrated his 89th birthday Friday. With 68 years in the organization, he is the longest tenured employee with Scully second in seniority at 67 years. Lasorda serves as special adviser to the chairman. He was presented with a huge cake on the field before the game and the crowd sang “Happy Birthday.” Lasorda and wife Jo shared a kiss before the current Dodgers greeted him.

UP NEXT

Rockies: RHP Jon Gray (10-8, 4.42 ERA) is coming off a franchise-record 16 strikeouts in his first career complete-game shutout, an 8-0 win over San Diego. He is 2-2 with a 3.38 ERA in five career starts against the Dodgers.

Dodgers: LHP Scott Kazmir (10-6, 4.59) starts for the first time since Aug. 22 after missing 28 games on the disabled list with neck inflammation. He is 4-6 with a 4.11 ERA in 13 home starts this season.