Gerard Deulofeu put the hosts ahead with a deflected effort just before the hour mark, but Juan Cala pulled Cardiff level nine minutes later with his first goal for the club.
A string of David Marshall saves looked to have rescued a valuable point for Ole Gunnar Solskjaer's men, but Seamus Coleman struck at the death to snatch victory for Everton.
"It was a really intense game," Martinez said. "I thought Cardiff were very good.
"We started the game really sharp, which forced them to change the way they were set up.
"We created a few open chances. I thought David Marshall in goal was phenomenal. I think it's as good an individual performance as you're going to see from a goalkeeper.
"Once you score that first goal and you let Cardiff back in, that became a difficult moment and a real test for us.
"But I was really pleased in the manner that we never panicked, we carried on doing the right things and you can say that you get a little bit lucky when you score the winner so late.
"But I think it's down to having that control and that patience, because it would have been all too easy to panic and play with your heart rather than your head.
"I do think we deserved the three points, but Cardiff deserve huge credit.
"For me they look a unit with a real togetherness, with a real know-how of what they were doing."
But Martinez expressed no sympathy for the visitors over a denied penalty for a Sylvain Distin challenge on Wilfried Zaha late on, adding: "Those decisions sometimes go for you and against you. It doesn't matter where you are in the table."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.