The Gunners came into the clash on the back of a 3-1 win over West Ham United after starting the season with back-to-back losses.
The hosts should have broken the deadlock after seven minutes when Petr Cech gifted the ball to Harry Arter, who blazed over with only the goalkeeper to beat.
However, Arsenal took the lead with 12 minutes gone as Granit Xhaka's corner found Shkodran Mustafi, who sent a bullet header into the back of the net.
Cardiff had a chance to restore parity in the 28th minute, but Bobby Reid failed to turn home Joe Bennett's cross before firing over the crossbar at the second time of asking.
Cardiff's persistence paid off as Benett's cross found Victor Camarasa, who spun away from Nacho Monreal before firing past Cech at the far post.
After a quiet start to the half, Arsenal went back in front after the hour mark, with Pierre-Emerick Aubameyang sending a fine curling effort into the back of the net.
Neil Warnock's men were level for the second time in the 70th minute thanks a close-range finish from Danny Ward after Arsenal failed to clear.
Unai Emery's men hit back and restored their lead with nine minutes remaining, with Lacazette turning his marker in the box before firing home to seal the win.