While you're correct, it is historically a loanword from Portuguese, not from Spanish. You can verify this in your favorite 国語辞典 if you want to. Like many loanwords, the pronunciation got corrupted a bit. (An example in the other direction: Godzilla, which you'd have to take several stabs at before a Japanese person guessed you meant gojira.)
Ão is a notoriously difficult diphthong to pronounce for many native speakers of other languages. Wikipedia says that it was even used as a shibboleth in the Paraguayan War, but it doesn't cite sources.