Media playback is not supported on this device
The Cowboys had rallied from 21-3 down at half-time in Dallas to level the scores before Mason Crosby drilled a retaken effort through the posts.
Green Bay now face the Atlanta Falcons next weekend, with the Pittsburgh Steelers playing New England.
The Steelers beat the Kansas City Chiefs 18-16 in Sunday's late game.
The Cowboys were top seeds in the NFC, having won 13 of their 16 games in the regular season, but a touchdown from Richard Rodgers and two for Ty Montgomery put the Packers in control at half-time.
Dallas fought their way back into the game but Packers quarterback Aaron Rodgers found Jared Cook with a 36-yard pass with three seconds left and Crosby did the rest - despite having to retake his kick after Dallas called for a timeout during his first effort.
The Packers have now won eight matches in a row.
Packers coach Mike McCarthy said Rodgers, who led Green Bay to victory in the 2011 Super Bowl, is "an incredible talent".
He said: "To do it when it's on the line like that, that's what great players do.
"That was one heck of a football game to be a part of. I just can't say enough about my team's resilience."
Pittsburgh failed to score a touchdown in Kansas but reached their 16th AFC Championship game thanks to six field goals from Chris Boswell.
The Steelers - who have won six Super Bowls, more than any other side - will now face Tom Brady's New England Patriots for a place in Super Bowl LI in Houston on Sunday, 5 February.
Brady beat the Steelers at the same stage of the play-offs on both previous meetings in 2001 and 2004.
The Green Bay Packers scored a 51-yard field goal with three seconds left to beat the Dallas Cowboys 34-31 and move to within one game of the Super Bowl.