The world and European champions eased into a 3-0 half-time lead in sultry Panama City thanks to Pedro's double and a goal from record scorer and stand-in captain David Villa, his 53rd on his 85th appearance for his country.
Playing their final match of 2012 and without rested midfield stalwarts Xavi and Xabi Alonso, Vicente del Bosque's side missed a host of chances before substitute Sergio Ramos curled in a superb free-kick in the 82nd minute.
Jesus Navas fed Markel Susaeta to score on his debut from close range two minutes later and the boisterous home fans were rewarded when Gabriel Gomez cheekily beat Iker Casillas with a chipped penalty three minutes from time.
"The balance between order and talent gave us the edge," Del Bosque said. "We took the game seriously, with a certain level of commitment, and our domination of the ball did not allow them many chances.
"We could have scored more goals in the second half but we made it easy for ourselves."
The match at the Rommel Fernandez stadium between the world's number one nation and 46th-ranked Panama seemed at times like a training match for the laid-back Spanish and Del Bosque was able to try out a couple of players who are on the fringes of the squad.
He started with Benat Etxebarria in a creative central role but the Real Betis midfielder was disappointingly wayward with his passing, while Athletic Bilbao midfielder Susaeta fluffed a close-range volley that he should have put away with ease.
Pedro, who scored a hat-trick against Belarus in a World Cup qualifier last month, exchanged passes with his Barcelona team mate Andres Iniesta to carve open the home defence for his opening goal in the 16th minute.
Iniesta danced into the penalty area to set up Villa, another Barca player, in the 29th and Juan Mata sent Pedro clear for his second and Spain's third two minutes before halftime.
Del Bosque replaced Pedro, Iniesta and Mata with Roberto Soldado, Cesc Fabregas and Jesus Navas at the break.
Navas and Soldado drew sharp saves from home goalkeeper Jaime Penedo early in the second half and Navas struck an angled shot against a post in the 66th minute.
It looked initially as if Fabregas was going to take the freekick that led to Spain's fourth but Ramos ran up and sent the ball arrowing past Penedo into the top corner.
Susaeta turned in a Navas cross to make it 5-0 before Benat tripped Nelson Barahona in the area and Gomez outfoxed Casillas, who had come on for Victor Valdes a few minutes earlier, with a delicate chip down the middle of the goal as the Real Madrid keeper dived away to his right.
"We played well, it was a good spectacle and we are returning to Spain feeling content," Mata said.
"They are still in with a chance of qualifying for the World Cup and the weather conditions were not the best for us but we performed well," the Chelsea midfielder added.
Spain's latest victory means they end 2012 with 13 wins and three draws, including the semi-final of Euro 2012 when their match against Portugal finished 0-0 after extra-time and Spain went through to the final after a penalty shoot-out.
They top World Cup qualification Group I on goal difference from France and their next qualifier is at home to Finland on March 22.