BALTIMORE — The Baltimore Orioles are heading into the final week of the season with much-needed momentum and an opportunity to take over the top wild-card spot in the American League.

Hyun Soo Kim hit his fifth home run, a two-run shot in the second inning, and the Orioles completed a three-game sweep of the Arizona Diamondbacks with a 2-1 victory Sunday.

Baltimore is 1 1/2 games ahead of Detroit for the second AL wild card and remained 1 1/2 games behind Toronto for the top spot. The Orioles begin a crucial three-game series at the Blue Jays on Tuesday.

"Our guys are warriors," Baltimore manager Buck Showalter said. "They grind through a lot of things. Working on short sleep, game 150-whatever. That's a hard game to win today."

Baltimore finished the regular season 50-31 at Camden Yards. It was the second time in three seasons the Orioles finished with at least 50 wins at home.

Arizona has been swept 13 times this season, including six on the road.

Orioles rookie Dylan Bundy (10-6) allowed the one run on three hits with five strikeouts over five innings. Bundy hasn't gone past the sixth inning in his past six starts.

Zach Britton picked up his American League-leading 46th save in as many chances. Manny Machado went 2 for 4 for his team-high 54th multi-hit game.

"We've been playing meaningful games in September for a while now, so it's not anything new to us," Britton said. "We've been to the post-season a few times now, so I think everyone knows how to treat these next few games. Just go out and be prepared, but at the same time you can't press any more so than you would in the first month of the season."

The Orioles took a 2-0 lead on Kim's drive off Braden Shipley. Shipley has given up 13 homers in 12 appearances this season.

"That home run was a great thing and it's amazing that it happened in the last game," Kim said through an interpreter. "Overall, the pitching was tremendous and it brought us the win. I am just happy for the team to win."

The Diamondbacks pulled within a run off Bundy in the third on an RBI single by Paul Goldschmidt. Baltimore reliever Mychal Givens entered in the sixth and held the Diamondbacks hitless over two innings.

Arizona was 1 for 7 with runners in scoring position.

Shipley (4-5) allowed two runs on four hits with six strikeouts over six innings in his 10th career start.

"I take this loss on my shoulders," Shipley said. "I'm not always going to be perfect, obviously, that's how baseball is. I have to live with it."

All six of the Orioles' series sweeps have come at home.

LOCKED DOWN

Givens tied a career high with four strikeouts. He now has 95 strikeouts over 73 innings this season (11.71 strikeouts per 9 innings). "That's a pretty good bullpen," Arizona manager Chip Hale said. "Givens is really, really good."

TRAINER'S ROOM

Diamondbacks: RHP Rubby De La Rosa (right elbow inflammation) has been shut down for the season. He will see a specialist Monday in Florida.

Orioles: OF Joey Rickard might not need surgery for his injured thumb, but the team will have a "definitive plan" to make sure he is ready for spring training, Showalter said.

UP NEXT

Diamondbacks: Archie Bradley (7-9, 5.02 ERA) opens the four-game series against the NL East champion Washington Nationals. Bradley is seeking his fourth win in six starts.

Orioles: Right-hander Kevin Gausman (8-11, 4.21 ERA) is expected to start the series opener against the Blue Jays on Tuesday. Gausman had been battling soreness in his oblique but felt fine after a couple of work days.