As you are not investing in a country/countries/states but in a stock (or a fund/etf), the fundamentals of the stock and where you are buying the stock are the important criteria.
When people commonly refer to investing in the S&P500, they are often talking about investing in a specific fund that tracks this specific index. This can e.g. be a mutual fund or an ETF. Or you could buy the 500 stocks that are part of the S&P500 yourself and rebalance their equivalent distribution on your own to mirror the index.
In that regard, investing in an fund that tracks European stocks would be roughly equivalent to investing in a fund that tracks US stocks, with possible small caveats like slightly increased currency risks and slightly increased management fees due to a higher variety in legal paperwork and currency exchanges depending on the specific fund/index (the EU does not have a common currency). The common market (free trade area) of the European Union reduces most of those costs already, but does not fully eliminate all of them.
Both the S&P500 and any European index fund you may choose are a selection based on various criteria (e.g. Market capitalization in small-caps). This could mean that the stocks inside your European fund could comprise 60% German companies and no Greek, Polish or Lithuanian company (or vice versa).
Since the goal of investing into a broad index fund is generally a specific form of diversification, make sure your index of choice mirrors your desired diversification by looking at the details of the index and the fund that is tracking said index. And, of course, look at the other very, very important aspects in choosing an index fund in detail (performance, fees(!), dividends, liquidity, country of origin, tracking error etc.).
That being said, if your overall goal is simply a high geographic diversification, you could also broaden your scope and look at funds tracking indices of the whole of the developed world (e.g. MSCI World) or a global index (e.g. MSCI ACWI). These include most stocks both in the S&P500 and in European indices (and various others).