Spanish firefighters on Friday were bringing under control a forest fire near Madrid that had cloaked the capital in a huge cloud of acrid smoke.