The home side dominated possession throughout the opening period but failed to trouble Artem Rebrov in the Spartak goal.
Benfica boss Jorge Jesus introduced Cardozo after the break and the substitute wasted no time in making an impact.
The Paraguayan striker latched onto a dangerous cross to the back post by Melgarejo on 55 minutes, towering above his marker to send a header through Rebrov's legs and into the net.
Spartak barely had time to respond before they were two goals behind just five minutes later, with Cardozo doing the damage once again.
A bright run from Dutch winger Ola John produced a pass into the area which Cardozo met first time to send a scuffed shot into the corner.
Spartak's misery was compounded in the final few minutes when Nicolas Pareja was dismissed for a wild late lunge.
Jesus's side kept possession comfortably in the closing minutes to secure their first win in this season's Champions League and keep their hopes of qualifying from Group G alive.