Spain's tax algorithm hunts inconsistencies, not fraud

Every April, millions of Spanish taxpayers open their draft income tax return and assume the hardest part is the math. It isn't. The real filter happens long before any human inspector ever looks at a file — inside an automated risk-scoring engine that the Agencia Tributaria has been quietly refining for years, and that by 2025 was cross-referencing over 1.2 billion records annually.

The system doesn't care if you meant to cheat

That's the blunt assessment from Emilio Baena, a former AEAT inspector with a decade of field experience who recently broke down the agency's internal logic on LinkedIn. His core argument strips away a lot of comfortable mythology: "Hacienda no busca fraude. Busca incoherencias." The agency isn't looking for fraud. It's looking for inconsistencies.

The distinction matters more than most taxpayers realize. Intentional evasion is actually harder to catch algorithmically. What the system excels at is spotting data points that don't fit together — a declared income that doesn't match what your employer reported, bank movements incompatible with your professional profile, or expense patterns that diverge sharply from your own history. None of those necessarily indicate wrongdoing. All of them trigger a closer look.

How the risk profile gets built

How the risk profile gets built

Baena describes four primary data streams feeding the algorithm. First, third-party reporting: if your employer withholds IRPF on your paycheck or your bank files interest income with the AEAT, that data exists in the system whether you include it in your return or not. A mismatch is an automatic flag. Second, banking behavior — irregular deposits, frequent transfers, or account balances that seem structurally incompatible with your declared earnings. Third, your own filing history. A sudden unexplained jump in income or deductions against a flat prior baseline generates doubt, not because jumps are illegal, but because they're statistically anomalous.

The fourth stream is the one people least expect: sectoral benchmarking. If you declare significantly less than the median taxpayer in your profession and autonomous community, the system flags it. Even if every figure is accurate. Even if it's entirely legal. The algorithm doesn't adjudicate guilt — it scores probability of discrepancy.

The result is what Baena calls a "perfil de riesgo": a risk profile that determines whether your return sails through the 85% of drafts approved without modification, or lands in the pile that accounts for 70% of all limited verification procedures. Those figures, extrapolated from historical AEAT trend data, tell the real story of how the agency allocates its attention.

Who gets hurt most when the flag goes up

Who gets hurt most when the flag goes up

Freelancers with irregular billing cycles are structurally exposed. So are landlords who have historically underreported rental income — the AEAT's cross-referencing with cadastral records and rental platform data has made that particular gap increasingly difficult to maintain. Beneficiaries of the Ingreso Mínimo Vital face a specific trap: the benefit is exempt up to 12,600 euros, but receiving it triggers a filing obligation regardless. Miss the filing, or file with a banking discrepancy, and what was a legitimate benefit becomes the starting point for a formal inquiry.

Baena's advice cuts through the anxiety with a practical edge. Review your draft against what third parties have already reported before you submit. Check your bank statements for anything that looks anomalous against your declared profile. If your income legitimately jumped — a new contract, an inheritance, a property sale — document the justification before the system asks for it. The AEAT isn't going to call you first.

The deeper shift nobody is quite ready for

The deeper shift nobody is quite ready for

What Baena is describing isn't just a tax compliance issue. It's a preview of how automated administrative systems increasingly operate across European public institutions — not by investigating individuals, but by running continuous population-level anomaly detection and surfacing outliers for human review. The inspector with the magnifying glass is largely a relic. The algorithm runs constantly, quietly, and without the cognitive biases that once made a persuasive explanation enough to close a case.

For the Renta 2026 campaign launching in April to cover fiscal year 2025, the practical implication is straightforward: your return is evaluated against a data environment you didn't fully construct and can't entirely see. The 1.2 billion records the AEAT processed last year didn't come from your forms. They came from your bank, your employer, your landlord, your broker, and the platforms you sold things on. Your declaration is just the last piece of the puzzle — and the algorithm already knows what shape it's supposed to be.