Police in Llodio said the man was withdrawing money around 8 a.m. when the snake slithered out of the Caja Madrid bank ATM and attempted to attack him, Euro Weekly News, Costa del Sol, Spain, reported Thursday.
The man grabbed his money and called police, who removed the reptile and took it to an animal shelter.
Police said the snake may have come from the nearby countryside or it may have been placed in the machine as a prank.
Investigators did not say whether the snake was venomous.
Celebrity Breakups and divorces of 2014 [PHOTOS]