PHILADELPHIA (AP) -- Ryan Howard hit a go-ahead, two-run homer in the sixth inning and the Philadelphia Phillies snapped a nine-game losing streak with a 2-1 victory over the Baltimore Orioles on Thursday.

Sean O'Sullivan of the Philadelphia Phillies throws a pitch at Citizens Bank Park in Philadelphia. (Hunter Martin, Getty Images)

The Phillies, who have the worst record in the majors at 23-45, avoided being swept in four consecutive series. They had lost 19 of 22.

Manny Machado hit his third career leadoff homer and second in three games against the Phillies. But he struck out with runners on first and third and one out in the seventh.

Jake Diekman (1-1) pitched a 1-2-3 sixth in relief of Sean O'Sullivan to earn the win in his first game back from a brief stint at Triple-A. Jonathan Papelbon closed for his 13th save in 13 tries.

Howard hit his 12th homer, connecting off starter Bud Norris (2-5) to put Philadelphia ahead for the first time in its four-game, home-and-home series against Baltimore.

(Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)