I don't know how to answer your question, but I thought that the fact that Raoul Bott, who was one of the greatest mathematicians of the 20th century, got degrees in engineering first would be an interesting tidbit. It was electrical engineering though....
I knew someone who had studied engineering for his undergraduate degree who have subsequently pursued a PhD in applied math, and I also know someone who finished her degree in engineering and subsequently pursued a PhD in statistics.
So the short answer is yes, it is possible. It would help if you have pursued at least a minor in math, though, to prepare for further graduate studies.
My real analysis professor obtained his B.S. in civil engineering and went to graduate school for math instead. He said he had to self study a lot. Also, there were examinations in algebra and analysis to get in, so he self studied to get good marks in these exams. Do note: he is from Iran so things are most likely different there.