Boston won its third in four games after a five-game losing streak. The Red Sox were 16-2 against the Orioles in 2009, winning the final eight meetings.
Adam Jones had a two-run homer for Baltimore, which overcame a 3-0 deficit but dropped to a major league-worst 2-15 this season.
The Red Sox loaded the bases with a single and two walks against two relievers in the eighth before Beltre took Johnson's 3-1 pitch inside for the go-ahead run. Matt Albers (0-2) gave up J.D. Drew's leadoff single before retiring the next two batters. Will Ohman walked Victor Martinez intentionally before walking Ortiz on four pitches.
Manny Delcarmen (1-1) got the win despite allowing an inherited runner to score in the eighth. Jonathan Papelbon got Julio Lugo to strike out with runners on first and second to end it for his fourth save.
Boston starter Jon Lester got into three jams, but left in the sixth inning with a 3-0 lead. He remained unbeaten in 13 career starts against Baltimore, 10-0 with a 2.22 ERA.
Ortiz, who was replaced in the lineup the past two games, entered hitting .146 with just two RBIs. He homered into the Green Monster seats off Jeremy Guthrie, moving Boston ahead 1-0 in the second.
The Red Sox added runs in the third and fifth to open a 3-0 edge.
Drew's sacrifice fly made it 2-0 in the third.