Questions of citizenship and migration from third countries are reserved to the member states of the EU, so the rules differ between the 28.
EU-wide: The EU "blue card scheme" is modelled on the US green card, and intended to provide a simpler migration route for highly skilled third country workers. At the moment it's only primarily issued by Germany, and interacts with their citizenship laws. The UK, Ireland and Denmark have opted out of the scheme.
France: In general, a non-EU citizen who has resided in France for 5 years can apply for French citizenship. This can be reduced to 2 years for some activities such as successful completion of certain French qualifications, or a "minimal" waiting period for some people, such as refugees, French army volunteers, etc. Naturalisation (in French)
Germany: An application can be made after 5 to 8 years, provided that there are no criminal convictions, no dependency on welfare payments, and language skills (for details, consult a lawyer). The applicant usually has to give up the original citizenship, but there are exceptions to that.
In 2017 there were 112,211 naturalizations.
Ireland: Non-EEA citizens can apply with 1825 days(5 years) legal residency over a 9 year period. Time spent on study visas does not count towards this.
Spain: The official site of the government(Spanish) explains that nationality requires a time of legal residence in the country, without differentiating between the reason for the residence (with the exception of refugees, who can apply for citizenships after 5 years).
The time ranges from a maximum of 10 years to a minimum of 1 year (people married/widow/offspring/adopted to/of/by Spanish citizens, or born in Spain).
The general rule is that five years with continuous permanent residency is enough to apply for citizenship. Exceptions include citizens of nordic countries (as short as 2 years), refugees and stateless persons (four years). Years as a student (not including PhD-students) does not count. You have to be 18 years or older to apply. Source in swedish
United Kingdom: Over 18s can apply for citizenship 12 months after obtaining indefinite leave to remain. The rules for who can apply for ILR depend on age and residence, but people who hold a Tier 2 skilled worker visa can generally apply after 5 years (hence 6 years to citizenship). Time spent in the UK on study visas generally doesn't count.