– Rex Ryan's return to the Meadowlands was a successful one — thanks to his pride and joy, the defense.

Buffalo's defense shut down Ryan's former team for much of Thursday night, and the Bills scored on offense and special teams in a 22-17 victory over the New York Jets.

Duke Williams returned a fumbled kickoff 19 yards for the go-ahead points, rookie Karlos Williams had a 26-yard touchdown catch, and Dan Carpenter kicked three field goals. Buffalo (5-4) moved into the wild-card playoff picture, while the Jets (5-4) have lost three of their past four games.

Ryan was fired by the Jets after six seasons and immediately hired by Buffalo last January. His defense had two interceptions, recovered a fumble and stopped the Jets inside the Bills 10 in the final minutes — prompting some vigorous fist pumps by Ryan, along with a flying headset, when Bacarri Rambo clinched it with a last-minute pick.

"Our guys stood on their heads and held them out of the end zone," said Ryan, who did not come out to the field during pregame warmups. "It felt weird. Two things dawned on me that I am no longer the coach of the Jets: I was looking at the wrong side of the sheet when we were getting stats, and I spent six years coaching in green and white, and I look out there and my team is in red."

Buffalo's offense made just enough key plays and held off a late surge by the Jets after Ryan Fitzpatrick threw for two touchdowns.