ATLANTA (AP) _ The Atlanta Falcons took out 32 years of frustration on a familiar nemesis Sunday.

Playing before their first sellout crowd in three years, the surprising Falcons (8-2) took sole possession of first place in the NFC West, scoring twice on defensive plays before clinching a 31-19 victory over San Francisco (7-3) on Chris Chandler's 78-yard touchdown pass to Terance Mathis.

The 49ers have dominated the West since 1980 and blown out Atlanta through most of the '90s. The Falcons captured their only division title 18 years ago and have been one of the league's sorriest franchises since entering the NFL in 1966.

But second-year coach Dan Reeves has turned things around in Atlanta, which was evident from the aroma of hamburgers and hot dogs wafting through the parking lot hours before the game began. Yes, they were actually tailgating outside the Georgia Dome.

Once inside, the raucous crowd of 69,828 watched the Falcons build a 24-6 lead in the fourth quarter, then give up two long touchdown passes by Steve Young that closed the 49ers to 24-19 with 3:09 remaining.

The fans grew uneasy, sensing a monumental collapse by the Falcons, who had lost five straight to San Francisco and needed a couple of first downs to run out the clock. Instead, Atlanta went for a touchdown.

On second-and-8 from the Falcons 22, Chandler went deep to Mathis, who made an over-the-shoulder catch while cornerback R.W. McQuarters stumbled to the turf. Mathis streaked the rest of the way for the clinching score, and the celebration resumed.

The Falcons were leading only 10-6 before scoring two touchdowns in the opening minute of the fourth quarter.

The first was set up when Ray Buchanan jumped in front of Young's pass and returned the interception 34 yards to the 1 with 28 seconds remaining in the third period. After an incomplete pass and a 1-yard loss on a run by Jamal Anderson, the quarter ended and the teams went to the other end of the field.

Anderson, rushing for 100 yards on 31 bruising carries to go over 1,000 yards for the season, then powered over from the 2 to push the Falcons' lead to 17-6. It was the second touchdown of the game for Anderson, who had a 10-yarder in the second quarter.

Two plays after the kickoff, Young was hit by Shane Dronett and lost the ball. Jessie Tuggle took it away from teammate Chuck Smith and rolled into the end zone for the fifth defensive TD of Tuggle's career, an NFL record.

The 'Niners didn't fold. Young, 21-of-40 for 342 yards, hooked up with Terrell Owens on a 54-yard touchdown pass with 11:16 remaining, then took advantage of a defensive error by William White.

The Atlanta safety let Jerry Rice get behind him, and Rice cradled the pass and cruised to the 65-yard touchdown that pulled the 'Niners within five points with 3:09 to go.

Rice had 10 receptions for 169 yards, but also dropped a couple of passes, including a sure touchdown pass in the first half, forcing San Francisco to settle for one of two field goals by Wade Richey.

Chandler was 12-of-21 for 198 yards, and the Falcons held a nine-minute lead in time of possession.