Ravens safety Ed Reed comes up from behind to slap the ball from Jets quarterback Mark Sanchez. (JOE GIZA/REUTERS)

The defense of the Baltimore Ravens reminded its former boss, Rex Ryan, just how thoroughly it can dominate a game. The Ravens scored three touchdowns on defense and managed not to mess things up too badly on offense, coasting to a 34-17 triumph over the Ryan-coached New York Jets here Sunday night at M&T Bank Stadium.

The Ravens scored a pair of first-half touchdowns on returns of fumbles by Jets quarterback Mark Sanchez on sacks. They added a second-half touchdown by cornerback Lardarius Webb on an interception return of a Sanchez pass.

“The performance by their defense was spectacular,” Ryan said.

The three defensive touchdowns for the Ravens set a franchise record. They improved their record to 3-1 and beat the Jets for a seventh consecutive meeting. Tailback Ray Rice had a first-half rushing touchdown as the Ravens built a 27-7 lead.

The Ravens did little else on offense, as quarterback Joe Flacco completed only 10 of 31 passes and had an interception returned for a touchdown. Flacco had two completions in the game’s final three quarters. He also lost a fumble.

“It wasn’t too pretty,” Flacco said. “But any time you get a win in the NFL, it’s a good one, especially when you are playing a good team like that. Our defense really showed up today.”

Flacco still had a better night than Sanchez did. Sanchez had four fumbles, losing three of them. He connected on 11 of 35 passes, with no touchdowns and an interception. The Jets’ touchdowns came on a first-half kickoff return by Joe McKnight and linebacker David Harris’s second-half interception return. The Jets’ record dropped to 2-2 with their second straight loss.

“You never expect to go out and have a performance like that,” Jets tight end Dustin Keller said. “We should never go out and play like that. To go out and be flat like that is unacceptable.”

In all, the game featured four touchdowns scored by the defenses and one by the special teams. The two offenses managed only one touchdown between them.

“I’ve been around football a long time,” Ryan said. “I’ve never seen anything like that before.”

Ryan was returning to Baltimore to face his former team, having served as the Ravens’ defensive coordinator before getting his head-coaching opportunity in New York.

“He created us,” said linebacker Jarret Johnson, who scored one of the Ravens’ defensive touchdowns. “Now he had to deal with us.”

The Jets were hoping for a bounce-back performance. They were coming off a loss in Oakland a week earlier in which they were uncharacteristically unable to stop the run, surrendering 234 rushing yards to the Raiders.

But their early gaffes enabled the Ravens to build their sizable first-half lead. The Jets forced a punt on the Ravens’ opening possession but had to start their first drive at their own 10-yard line. Ravens safety Ed Reed blitzed from Sanchez’s blind side and hit the quarterback, knocking the ball from Sanchez’s hand. Ravens linebacker Jameel McClain picked up the ball and maneuvered into the end zone for the touchdown, and the officials ruled in a replay review that Sanchez’s arm had not been moving forward in a throwing motion before he lost the ball.

The Jets wasted no time getting even, as McKnight fielded the kickoff seven yards deep in the end zone and sprinted 107 yards to the opposite end zone. It was the longest play in Jets history, and the longest ever allowed by the Ravens.

The Ravens used a 52-yard catch and run by Rice to set up the first of place kicker Billy Cundiff’s two first-half field goals, then got the ball back on a punt and drove to a three-yard touchdown run by Rice for a 17-7 advantage. Cundiff connected on another field goal early in the second quarter after the Ravens recovered the ball on a shotgun snap that Sanchez failed to catch.

Things got even worse for Sanchez later in the second quarter when he lost the ball on a jarring hit by Ravens defensive tackle Haloti Ngata. The free football was grabbed by Johnson, who scored a touchdown. Referee Mike Carey announced after a replay review that the ball had been out of Sanchez’s hand before the quarterback’s arm was moving forward, making the play a fumble and touchdown rather than an incomplete pass. The ruling left Ryan so angry that he called a timeout before the extra point was taken and waved Carey to the Jets’ sideline for a discussion.

“I wanted to get a better explanation from Mike Carey. . . . I thought it was an incomplete pass,” Ryan said.

Flacco, who was en route to completing only 8 of 27 first-half passes, gave the Jets some hope when he threw a pass directly to Harris. The linebacker made the interception and went 35 yards for a touchdown, and place kicker Nick Folk’s field goal a little more than two minutes before halftime got the Jets within 10 points.

The Jets had a chance to get closer in the third quarter when Flacco lost a fumble on a sack by linebacker Aaron Maybin. But on the next play, Sanchez tried to deliver a pass to wide receiver Santonio Holmes while being hit by linebacker Terrell Suggs. Webb stepped in front of Holmes to make the interception and went 73 yards for a touchdown.

“He had to get the ball out in a split second all night,” Webb said of Sanchez. “It made it easier on us in the back.”