Spain struggled to break through the Tunisian defence, who put in a plucky and relentless performance, and left goalkeeper Aymen Mathlouthi largely unthreatened.
The goal came as a relief to the Spaniards after they had been stymied for almost 90 minutes, although some unexpected doubts are now hovering over one of the World Cup favourites.
That proved to be the final bit of goal-mouth action as Spain head into the World Cup on a high. However, Julian Green took advantage of a Djibril Sidibe slip to fire a near-post effort past Hugo Lloris on the stroke of halftime to give the visitors a shock lead.
France avoided an embarrassment in front of their fans in their farewell game heading to the 2018 World Cup as they forced United States of America to a 1-1 draw on Saturday.
"I've played as many players as I can in all three warm-up games and that teaches you".
There remains plenty of unanswered questions for Les Bleus heading into next weekend's opener against Australia, who beat Hungary 2-1 earlier on Saturday.
Denmark recorded a 2-0 win over fellow finalists Mexico thanks to strikes from Yussuf Poulsen and Christian Eriksen, while Peru played out a stalemate with Sweden, who will also be in Russian Federation.
It looked like being a frustrating night for 2010 champion Spain as well as it struggled to break down a Tunisia side which caused it difficulties on the counter attack.
Julen Lopetegui has been in charge for 20 successive matches following the disappointment of Euro 2016, and he's guided La Roja through a transitional period.