I want to buy as a resident as I will live in the property, but I earn overseas?

Banks determine your residence status depending on where you pay your taxes

Approval for a mortgage in Spain will always depend on where you pay your taxes. This is how banks will determine your residence status for the purpose of lending. If you live in Spain but have a business in the UK, and you pay UK taxes, you will not be considered to be a Spanish resident. You will need two years of tax returns in Spain to apply for a Spanish mortgage.