Shkodran Mustafi and Pierre-Emerick Aubameyang - with his 150th goal in the top five leagues of European football - twice gave the Gunners the lead before Alexandre Lacazette settled matters nine minutes from time.
Victor Camarasa and Danny Ward grabbed equalisers as Cardiff scored their first goals since returning to the Premier League - but Arsenal held on for only their second away league win in 2018.
Mesut Ozil was restored to the Arsenal line-up after missing the first win of the Unai Emery reign.
The German sat out the West Ham success amid reports of a training ground bust-up with his manager, who insisted the Germany midfielder had simply missed the game through illness.
Lacazette started his first game under Emery with Aubameyang deployed on the left of the attack and supported by Ozil and Aaron Ramsey.
So how did the two teams fare? See the gallery below for our player ratings:
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies