Geno Smith threw two touchdown passes, including a go-ahead 69-yarder to Santonio Holmes in the fourth quarter, and the Jets overcame a team-record 20 penalties to hang on and beat the Buffalo Bills 27-20 in an ugly game Sunday.

Wide receiver Stephen Hill #84 of the New York Jets celebrates his 51 yard touchdown catch with teammate Jeremy Kerley #11 against the Buffalo Bills (Rich Schultz /Getty Images)

Smith slightly outplayed EJ Manuel in a matchup of the first two quarterbacks selected in the NFL draft in April. But this one was tough to watch at times with the barrage of penalties. The Jets (2-1) rolled up 168 yards in penalty yardage, and nearly gave it away against the Bills (1-2).

Capping a drive kept alive by four straight penalties on the Jets, Manuel connected with Scott Chandler for a 33-yard touchdown, then hit Stevie Johnson for a 2-point conversion to tie it at 20 with 10:39 left in the game.

Bilal Powell ran for a career-high 149 yards for the Jets.