The Falcons, as 11.5-point underdogs, shocked the NFL world Sunday.

Wide receiver Julio Jones caught a 5-yard touchdown with 2 seconds left to give the Falcons a 29-22 win over the San Francisco 49ers at Levi’s Stadium.

“That was awesome at the end, with the game on the line,” Falcons coach Dan Quinn said. “The moments as a coach that you totally live for.”

» MICHAEL CUNNINGHAM: This win just makes you wonder

The Falcons overcame 11 penalties and an untimely fourth-quarter fumble to pull off the shocker. They needed a 10-play, 70-yard drive for the victory and Jones slightly moving the ball to break the plane.

“Just 11 guys doing the right thing and being resilient,” Jones said. “(Tight end Austin) Hooper did his job by running his route. I came underneath him. I knew it was the last play and I had to get in the end zone and score. (Matt Ryan) threw a strike to me.”

The 49ers knew quarterback Matt Ryan would target Jones a play after Hooper nearly made a difficult touchdown catch that was initially ruled a touchdown on the field but overturned on replay.

“Matt (Ryan) said ‘everybody get in the end zone,’ ” Jones said. “I knew I was running down the goal line, but when he stopped me, because he was trying to protect me. I knew to get in the end zone.”

Jones leaped up and on the slow-motion replay, the ball noticeably eased over the plane for the score.

The 49ers — in the hunt for the NFC’s top playoff spot — dropped to 11-3 but still clinched a playoff berth with the Rams’ loss to the Cowboys. The Falcons’ season of despair and disappointment was boosted by the victory as they improved to 5-9.

The Falcons are 4-2 since starting the season 1-7 before their bye week.

“Just a glimpse of what we could have been,” linebacker De’Vondre Campbell said.

Jones had 13 catches for 134 yards and two touchdowns to power the Falcons’ offense.

“It was no secret that our plan was to get him involved,” Ryan said.

Ryan completed 25 of 39 passes for 210 yards and two touchdowns. He finished with a passer rating of 95.

San Francisco tight end George Kittle finished with 13 catches for 134 yards — 91 of them coming after the catch. San Francisco quarterback Jimmy Garoppolo completed 22 of 34 passes for 200 yards and a score. He finished with a passer rating of 90.3.

Campbell led the Falcons with 11 tackles and a forced fumble and a fumble recovery.

With San Francisco leading 13-10 and the Falcons about to get the ball back, San Francisco’s Ross Dwelley knocked the ball away from returner Kenjon Barner. San Francisco’s Kyle Juszczyk recovered. Two plays later, quarterback Jimmy Garoppolo tossed a 2-yard touchdown pass to Juszczyk to put the 49ers up 19-10 with just over 10 minutes to play.

The Falcons would not back down.

The Falcons added a 1-yard touchdown run by Qadree Ollison with 5:15 to play to make it 19-17.

The Falcons’ defense needed one more stop, but forced the 49ers to settle for a 43-yard field goal with 1:48 left to play.

Ryan and Jones went to work and came up with the winning play.

Atlanta’s Olamide Zaccheaus scooped a fumble on a 49ers desperation razzle-dazzle kickoff return to score the final points.

The Falcons overcame some miscues on their way to the stunning victory.

The Falcons finished with 11 penalties for 98 yards and some of the untimely variety.

Defensive end Adrian Clayborn had a roughing the passer penalty on third-and-19 that gave the 49ers a first down on their first touchdown drive.

With the score 10-10, the Falcons’ Foye Oluokun recovered an onside kick to start the second half. But the Falcons were called for an illegal formation.

After forcing the punt, Barner broke loose for a 47-yard return, but safety Jamal Carter’s block in the back brought the Falcons back to the 8 yard line. It was essentially a 50-yard penalty. Instead of starting at 49ers’ 42, the Falcons started at their 8 yard line.

The ensuing drive was stalled by a delay of game penalty. The Falcons contended that the officials did not reset the play clock.

The Falcons struggled to sustain early momentum.

After three punts to start the game, two by the Falcons, the 49ers went on an crafty 21-play touchdown drive that was capped by a 2-yard run by running back Matt Breida. The 49ers converted four third-down situations and one fourth-down in the 88-yard drive that took 10:43 off the clock.

Falcons wide receiver Julio Jones talks about the touchdown grab in the closing seconds of the 22-29 win over San Francsico. (Video by D. Orlando Ledbetter/AJC)

The Falcons leaned on Jones to answer. Ryan completed four passes to Jones for 48 yards in the 11-play, 70-yard touchdown drive, including a 28-yarder and a 5-yard touchdown pass to tie the game, 7-7.

It was Jones’ first touchdown catch in 10 games (since Week 3 against the Colts).

The Falcons’ defense held and forced a punt.

The offense went on the move, working the ball down to San Francisco’s 25. Ryan tossed a potential touchdown pass to Jones in the end zone. The Falcons challenged the apparent pass interference.

The replay board at the stadium clearly showed 49ers cornerback Emmanuel Moseley grabbing Jones’ jersey, but the refs didn’t overturn the incomplete pass call by rule.

The Falcons had to settle for 43-yard field goal to take a 10-7 lead.

The 49ers, who got a 37-yard run from former Falcons running back Tevin Coleman, drove down to the Falcons’ 4 and had to settle for a 23-yard field goal from Robbie Gould to tie up the game at halftime.

Gould made a 46-yard field in the third quarter to put the 49ers up, 13-10 and things got interesting.

“It was amazing,” said defensive tackle Grady Jarrett, who had a forced fumble. “I think everyone on the sideline had confidence that it wasn’t close to being finished, even on that close call with Hooper. We thought we had it.

“We still had time left, and we still had an opportunity to win the game.”