SAN DIEGO — Alex Smith and the Kansas City Chiefs have made the AFC West a three-team race.

Cairo Santos kicked a 48-yard field goal field goal with 21 seconds left and the Chiefs beat San Diego 23-20 Sunday, snapping the Chargers’ five-game winning streak.

The Chiefs moved into field goal range thanks to Smith, who completed three straight passes on the drive for 43 yards, including a 29-yarder to Dwayne Bowe.

Smith was playing on the same field where he led Helix High to consecutive San Diego Section championships.

Coming off their bye, the Chiefs (3-3) pulled within 1 ½ games of San Diego (5-2). The Denver Broncos (4-1) hosted San Francisco on Sunday night. Had the Chiefs lost, they would have dropped three games behind San Diego.

The Chargers flunked their sternest test in a month and lost for the first time since a defeat at Arizona in the season opener.

Jamaal Charles scored once and gained 95 yards to give him 6,113 for his career, moving him to the top of Kansas City’s career list. He passed Priest Holmes, who had 6,070.

The Chargers, facing an established quarterback for the first time in four games, allowed Smith to complete 19 of 28 passes for 221 yards.

San Diego’s Philip Rivers was 17 of 31 for 205 yards and two touchdowns.

Smith had given the Chiefs a 20-14 lead with an 11-yard touchdown pass to fullback Anthony Sherman with 14:50 left.

Sherman broke a tackle inside the 10 and scored to cap an 11-play, 70-yard drive. On the previous play, a holding call against Chargers cornerback Richard Marshall nullified a sack of Smith and gave the Chiefs a first down at the 11.

The Chargers got to the Kansas City 6 before Rivers threw two straight incompletions and San Diego had to settle for Nick Novak’s 24-yard field goal to close to 20-17.

Novak kicked a 48-yarder to tie the game with 1:57 left.

Novak has 31 straight field goal conversions, breaking John Carney’s team record of 29 set in 1992-93.

Antonio Gates caught a 27-yard touchdown pass from Rivers just before halftime. It was the 67th career TD pass from Rivers to Gates, the most in NFL history from a quarterback to a tight end. Rivers also extended his team record to 27 straight games with at least one touchdown pass.

The pass was tipped by 6-foot cornerback Ron Parker but the 6-4 Gates made the catch to give the Chargers a 14-10 lead just before halftime.

San Diego backup tight end John Phillips made his first catch of the season a big one, a 1-yard touchdown reception late in the first quarter to cap a drive that was kept alive by a holding call and a pass interference call against the Chiefs.

The Chiefs came right back on a drive capped when Charles weaved in and out of traffic to score on a 16-yard run on the first play of the second quarter. Former teammate Brandon Flowers leveled him a yard into the end zone, too late to keep the Chiefs from tying it at 7.

Flowers later left the game with a concussion.

After forcing the Chargers to punt, the Chiefs ate up 9 minutes, 29 seconds in moving to the San Diego 10, where Santos kicked a 28-yard field goal for a 10-7 lead.