BALTIMORE -

Matthew Stafford threw two touchdown passes, Calvin Johnson had five catches for 111 yards and a score, and the Detroit Lions beat the Baltimore Ravens 27-12 in a preseason game Friday night.

Stafford went 12 for 17 for 184 yards in four possessions. He failed to produce a score in three drives last week against Cleveland, then came up empty in his first two series against Baltimore before guiding touchdown drives of 93 and 70 yards.

Stafford threw an 18-yard TD pass to Johnson and connected with Titus Young for a 24-yard score to help Detroit (No. 11 tie in the AP Pro32) take a 17-9 halftime lead.

Operating under first-year coordinator Dean Pees, Baltimore's defense gave up 254 yards in the first half. The Ravens (No. 5) are trying to rebound from an offseason injury to linebacker Terrell Suggs and the loss of free agents Cory Redding and Jarret Johnson.

"We have to complete plays, not just be in position to make them," Pees said at halftime. "Communication still isn't where we want it to be. We need to get better, and we will."

Baltimore's points came on four field goals, two apiece by Billy Cundiff and Justin Tucker.

The Ravens had two kick returns for touchdowns called back because of penalties. Deonte Thompson had a second-quarter kickoff return nullified, and Asa Jackson's punt return in the third quarter was wiped out.

Replacement officials called 20 penalties for 177 yards, including 13 infractions for 123 yards before halftime.

Joe Flacco went 7 for 12 for 79 yards and led the Ravens to a pair of field goals before leaving early in the second quarter. Ray Rice played only two series, gaining 12 yards on five carries and catching two passes for 11 yards.

After getting to midfield on their first possession, the Ravens then moved 60 yards before Cundiff kicked a 32-yard field goal for a 3-0 lead. Flacco went 4 for 7 for 43 yards on the drive, which was aided by a roughing-the-passer call on Nick Fairley.

On Baltimore's third possession, Jacoby Jones ran 35 yards on a reverse, and Detroit's Justin Durant was called for a facemask penalty to set up a 50-yard field goal by Tucker for a 6-0 lead.

Stafford put the Lions ahead with a drive of five plays that included three completions to Johnson for 83 yards. On the last one, Johnson made an excellent catch over cornerback Jimmy Smith in the end zone.

"You're talking about a person who should probably be running track, but he chose football," Ravens linebacker Ray Lewis said. "He's a mismatch for a lot of people. The bottom line is you've just got to make him earn his check. Today, he earned his money."

In his final series, Stafford completed passes to four receivers in a march that ended with Young diving into the end zone on a third-and-4 play.

The Lions were without running backs Jahvid Best (concussion) and Mikel Leshoure (hamstring). Kevin Smith started and ran for 11 yards on four carries, and reserve Stephfon Green went 76 yards for a touchdown with 43 seconds left.

Backup Stefan Logan was carted off the field in the second quarter with an ankle injury after colliding with Stafford on a handoff.