Skip to main content

23 May 2025

Understanding tax residency and social security for expats in Spain

Written by

Written by: María

Spanish Payroll Specialist

Relocating to Spain as an expat is an exciting step—whether you’re joining a local company, working remotely for a foreign employer, or freelancing as a digital nomad. But with the move comes a new set of financial and legal obligations that can easily be misunderstood or overlooked. Tax residency and social security contributions in Spain are two of the most important areas to get right, not only for compliance but also to access public services like healthcare and retirement benefits.

If you’re living and working in Spain for an extended period, you may become liable for Spanish income tax and be required to contribute to the local social security system, even if your employer is based abroad. This article breaks down what you need to know, including when tax residency starts, how the Beckham Law works, and how an Employer of Record (EOR) can help you manage it all without setting up your own legal structure.

Tax residency rules in Spain: when do you become a resident?

Spain determines tax residency primarily through the 183-day rule. If you spend more than 183 days in Spain in a calendar year, you are generally considered a Spanish tax resident, even if you continue to work for an overseas employer or retain ties to your home country.

But it’s not just about counting days. Spain also uses a “centre of vital interests” test. If your primary economic activities, business operations, or family ties are located in Spain, you may be classified as a tax resident, even if you technically spend fewer than 183 days in the country.

Once you are considered a resident for tax purposes, you become liable for tax on your worldwide income. This includes:

  • Salary from foreign or local employers,
  • Rental income,
  • Investment earnings, and
  • Business profits.

As a resident, you must also register with the Agencia Tributaria (Spanish Tax Agency) and obtain a Número de Identificación Fiscal (NIF) for filing your annual tax return (Declaración de la Renta).

Spain’s recently introduced digital nomad visa offers a legal pathway for remote workers to live in the country while working for non-Spanish employers, though it comes with specific eligibility criteria and tax implications that expats should review carefully.

What is the Beckham Law and who can benefit?

Spain’s Special Expats Tax Regime, commonly known as the Beckham Law, was introduced to attract foreign professionals. It allows eligible expats to be treated as non-residents for tax purposes, even while living in Spain, for a maximum of six years.

Key benefits include:

  • A flat 24% income tax rate on Spanish-sourced income up to €600,000 (47% above this),
  • Exemption from worldwide income taxation, which means your foreign investments or salary from abroad may not be taxed in Spain.

This regime is open to:

  • Professionals relocating for work under a Spanish employment contract,
  • Executives transferred to Spain by a multinational,
  • Certain remote workers who switch to a Spanish contract or relocate as part of international mobility.

To qualify, you must apply within six months of registering with Spanish Social Security, and you cannot have been a tax resident in Spain in the past five years. If you’re working remotely for a non-Spanish company and want to access this regime, you’ll need a Spanish contract, which is where an EOR can play a crucial role (more on that later).

Double taxation agreements: avoiding being taxed twice

One of the biggest concerns for expats working in Spain is the risk of double taxation, being taxed by both Spain and your home country. Thankfully, Spain has signed over 90 Double Taxation Agreements (DTAs), including with countries like the UK, US, Canada, and Germany.

These treaties determine:

  • Which country has the right to tax specific types of income,
  • How tax credits are applied to avoid duplication,
  • Residency tie-breaker rules for individuals who meet the criteria in more than one country.

For example, under the UK-Spain DTA, employment income is generally taxed in the country where the work is performed, while pensions and dividends have more complex rules. In the US-Spain treaty, the foreign tax credit system applies, allowing US citizens to offset Spanish taxes against their US liabilities.

To benefit from a DTA, you’ll often need to:

  • Provide a tax residency certificate from your home country,
  • Properly declare your income and claim credits in both jurisdictions.

Consulting a cross-border tax advisor or working with an EOR can help you manage this process accurately.

Social security obligations for expats in Spain

Your social security responsibilities in Spain depend on how you are employed. Generally, if you work physically from Spain, even for a foreign company, you may be expected to pay into the Spanish system.

If you’re hired under a Spanish employment contract, either by a local company or via an EOR, you’re automatically registered with Seguridad Social, Spain’s social security system. Contributions are shared between employer and employee and cover:

  • Public healthcare,
  • Pension accrual,
  • Unemployment insurance,
  • Maternity and paternity benefits.

Remote workers with foreign employers

If you’re working remotely from Spain for a company based abroad and don’t switch to a Spanish contract, your situation can be more complicated. If your employer doesn’t have a Spanish legal entity or EOR partner, they may not be able to register you with the Spanish social security system, leaving you uninsured and potentially non-compliant.

Alternatively, if you’re still contributing to another EU country’s system, EU Regulation 883/2004 may allow you to remain in your home country’s social security scheme temporarily (usually for up to 24 months) through an A1 certificate. However, this only applies to EU nationals working for EU-based employers.

Freelancers and autónomos

If you’re self-employed or freelancing in Spain, you must register as an autónomo and pay your own social security contributions. This grants access to public healthcare and a pension, but rates and benefits can vary significantly based on your declared income and status.

How an Employer of Record (EOR) can help expats stay compliant in Spain

If you’re moving to Spain to work remotely or you’re employed by a company that doesn’t have a legal presence in the country, an Employer of Record (EOR) can help you stay fully compliant with local tax and social security laws.

A Spanish EOR acts as your legal employer in Spain, issuing you a compliant employment contract while your foreign employer retains control over your day-to-day responsibilities.

Here’s how an EOR supports your compliance:

  • Provides a local Spanish employment contract, allowing access to benefits like the Beckham Law and local protections.
  • Handles payroll, tax withholding, and social security contributions, ensuring accurate filings with Spanish authorities.
  • Registers you with the Spanish tax and social security systems, so you can access public healthcare and pension rights.
  • Offers administrative support for visa applications, tax residency certificates, and DTA paperwork, reducing your stress and legal risk.

For instance, a German software developer relocated to Barcelona to work remotely for a US-based tech startup that had no legal presence in Spain. Without a local contract, the developer couldn’t register for Spanish social security or qualify for the Beckham Law tax regime.

The developer could issue a locally compliant employment contract by working with a Spanish Employer of Record. The EOR registered the employee with the Spanish tax authority, handled payroll and social security contributions, and ensured full compliance with residency laws.

This allowed the developer to access healthcare and pension benefits in Spain, while benefiting from favourable tax treatment, all without the employer needing to open a Spanish entity.

This solution is ideal for remote workers, digital nomads, or professionals relocating to Spain for personal reasons while continuing to work for a non-Spanish company. An EOR bridges the legal gap and ensures you’re not left in a grey area.

Manage taxes and social security

Understanding how tax residency and social security work in Spain is essential for any expat planning to live and work there, especially if you’re not employed under a traditional local contract. From becoming a tax resident after 183 days, to taking advantage of the Beckham Law, to ensuring you’re not taxed twice on the same income—every step matters.

Social security compliance is equally important. Without proper contributions, you could lose access to public healthcare or pension entitlements. And for remote workers on foreign contracts, this can become a legal and administrative challenge.

That’s where a Spanish Employer of Record becomes invaluable: ensuring you’re employed legally, registered correctly, and fully protected under Spanish law.

Thinking of working remotely from Spain or relocating without a local contract? Reach out to our team to see how our Spanish EOR services can help you relocate compliantly and confidently.

Written by

Written by:

María | Spanish Payroll Specialist

As a passionate Payroll Specialist based in the sunny city of Barcelona, she brings years of experience in the payroll industry, specialising in assisting international businesses in smoothly expanding their operations into Spain. Her efforts for helping companies navigate the complexities of Spanish payroll and employment regulations makes her an invaluable resource for HR managers and business development teams. When she's not crunching numbers, you might find her exploring Barcelona's vibrant tapas scene or cheering on her favourite football team, FC Barcelona.

Get in contact