What does 老外 mean if the Chinese speaker is in a foreign country?
Does 老外 mean a foreigner who is from the standpoint of the speaker? So is it OK to call Spainard as 老外 even if the speaker lives in Spain, as long as the speaker is not Spainard?


Yes 老外 is relative to the speaker's nationality or ethnicity, not their geographical location. If the speaker is a Chinese person living in Spain, then 老外 covers all non-Chinese people living anywhere in the world including in Spain.

Also note, technically 老外 means foreigner i.e. people with different nationality, but in real life usage it's most used for 'foreigners with dissimilar appearances from the majority of Chinese people'. For example, it's technically correct, but non-idiomatic to call Japanese 老外, neither does it sound intuitive to call a Chinese-American 老外.