Madrid ranked 12th place while Barcelona came in 14th in the European Digital City Index of startups released on Wednesday.
The index released on Wednesday was created by UK-based innovation charity Nesta as part of the European Digital Forum. The index rates cities by how well they create a supportive environment for digital companies, from local business regulations to available financing to the skill level of the workforce.
"There is some good-natured rivalry between Madrid and Barcelona concerning which is best for startups," the study states, noting that Barcelona was named a "front-runner" in a separate ranking of entrepreneurship and innovation by Nesta.
"However, despite a highly-supportive policy environment... in our ranking, Barcelona scores slightly lower of the two."
London topped the charts for both startups and "scaleups" - the next step after the startup phase, where a company has figured out a good business model and wants to expand.
In second place for startups was Amsterdam, while Stockholm took second prize for scaleups.
Top 15 European cities for startups and scaleups
Source: European Digital City Index 2015.
Spain’s two largest cities both ranked relatively low in terms of the skills of their workforce, particularly in how many people can speak English. Madrid was rated the worst out of 35 European cities while Barcelona came in 32nd place for English language abilities.
"Madrid's overall ranking could be improved by increasing English language skills and improving access to financial resources," the report states.
"English skills were included since, like it or not, 'English is the language of the internet': it is by far the most commonly found language on webpages," the report added. “Moreover, many European startups look towards the US for their customers or investors; even if this is not the case, it is clear that the ability to market oneself in English helps in selling across borders.”
Still, both Madrid and Barcelona were praised for their business and entrepreneurial environments, boosted by city governments that support startup growth.
Madrid is a "friendly city with a strong sense of community among its startups," and Barcelona’s city hall programmes help startups to "seed funding to set up their business", the report states.
In particular, the report highlighted Madrid’s recent South Summit startup fest and Barcelona’s government-funded programme to support entrepreneurs, Barcelona Activa.
The report did warn that certain countrywide policies could hinder the growth of startups.
"Tax incentives are regularly described as too opaque, and there is some concern that new laws would penalise startups looking to move out of Spain, which could severely hamper growth," the report states.
The cities ranked at the bottom of the index for startups were Bulgarian capital Sofia (33), Athens (34) and Maltese capital Valletta (35).