Teenager’s economics project noticed flaws in accounting a year before solar and wind power firm tries to avoid becoming Spain’s biggest bankruptcy

As Spanish engineering and renewable energy giant Abengoa struggles to avoid becoming the country’s biggest bankruptcy, it has emerged that a 17-year-old schoolboy predicted its collapse a year ago, spotting accounting discrepancies apparently overlooked by both Deloitte and Standard & Poor’s.

Pepe Baltá, a secondary school student in Barcelona, chose Abengoa as his economics project and noticed flaws in its accounting. “If it does not act soon, there is a strong risk Abengoa will go into bankruptcy,” Baltá wrote last year in his 18-page paper, titled Analytical report on Abengoa, 2012 and 2013.

Baltá, who is now 18 and studying medicine, said he was “very surprised that what I wrote actually happened. I only have basic secondary school knowledge of economics”.

“I have some accounting knowledge,” he told El Mundo newspaper, “and Abengoa’s accounts did not seem to add up. There was a lot of debt and few active assets compared to fixed ones. The big surprise was that negative profits were being converted into positives. I didn’t understand how they could do that.”

Only weeks before the solar and wind power company, which employs 27,000 people worldwide, admitted to €9bn (£6.5bn) in debts, the ratings agency Standard & Poor’s upgraded its long-term rating on the company, saying it expected it to “execute various actions to reduce debt over 2015”.

At the time, a company press release described the S&P upgrade as “the validation of Abengoa’s financial plan”. It was not until 13 November that Deloitte, the company’s auditors, expressed any alarm about the company’s financial situation.

Abengoa filed for bankruptcy protection last month and banks have employed KPMG to go through its accounts to get a clearer picture of its financial situation. The industry minister José Manuel Soria has said its debts could be as high as €25bn.

The company has already started to lay off some of its 7,000 Spanish employees. It is based in Andalucía, a region with a more than 30% unemployment rate – the highest in the EU. However, the government – which faces a general election on Sunday – has ruled out any form of state bailout.

Abengoa was hit by the sudden withdrawal in 2013 of previously generous subsidies to the renewable energy sector after the Spanish government performed a volte-face on energy policy.

Abengoa has been under pressure to sell assets immediately, including a 47% stake in US-listed Abengoa Yield. But at a meeting last week between the company, creditor banks and KPMG the idea was put on hold, as Abengoa feared the partial sale might hurt its overall share value.

It has raised a loan to keep creditors at bay until the end of the year but needs €350m to see it through the next three months.

Meanwhile, Baltá said neither Abengoa nor Deloitte have tried to recruit him.

“I don’t know if it’s because they haven’t heard of me or because they’d rather not have anything to do with an 18-year-old boy,” he said.