It could have been more, with Joaquin Correa hitting the bar and Inter spurning several more chances, as Spezia coach Thiago Motta had a night to forget against the club he won the Treble with as a player.
"We did what we needed to, which is to win at home," Martinez told DAZN. "But the pitch wasn't in a good state. We struggled to play our game, we hope it improves. We are fighting for important things, the pitch must be at its best."
Inter climbed to second place on 34 points, two clear of AC Milan in third and one behind leaders Napoli ahead of their games against Genoa and Sassuolo respectively later on Wednesday. Spezia are 17th with 11 points.
The two sides approached the game in contrasting form, with Inter winning seven matches during a nine-game unbeaten run in all competitions and relegation battlers Spezia losing three of their last four league outings.
An injury pile-up left Inzaghi with a makeshift defence of Danilo D'Ambrosio, Milan Skriniar and Federico Dimarco, but the champions were soon on top and took a deserved lead after 36 minutes when Gagliardini met a deft Martinez backheel flick to sweep home a finish.
Samir Handanovic showed great reactions to deny Kelvin Amian's header with a one-handed save, but it was a rare Spezia chance and Inter fired 14 shots before the break, their highest tally in a first half in Serie A this season.
Inter didn't let up as Correa rattled the underside of the bar before Martinez calmly dispatched his penalty in the 58th minute following a handball.