Based on a hasty scan of non-Romance Spanish words in RAE’s Diccionario de la lengua española, loanword nouns that were absorbed into the language acquired a male grammatical gender. Examples include el tequila, el chocolate, el pancit, and el abacá.
Given this, how is grammatical gender applied when Spanish borrows words from languages without that concept (Nahuatl, Quecha, Tagalog, etc.)?