The size of the country a doesn't really matter, Uruguay and Paraguay both received significant amounts of European immigration and they're relatively small and relatively poorer countries than Mexico. Political stability is also not a dealbreaker; in the case of Paraguay post-war of triple alliance, you can't argue for stability. Mexico could have still lost all the northern territories to the US and attract immigration. I'd say, you basically need two things:
- Political willingness to promote immigration; Brazil subsidized it at some point, Argentina welcomed pretty much anyone, Paraguay (after losing the war of triple alliance) was desperate to grow its male population.
- Good PR; people need to want to come to set roots in your country. The US had the American dream, Brazil and Argentina had similar promises. Even Peru had a pretty good rep and attracted quite a bit of Asian immigration. A gold rush or rubber boom helps here, but even in OTL Mexico has plenty of both and a shit ton of silver and yet a "rush" never happened because it wasn't promoted as such.
Mexico had neither one of these. After the Mexican-American War and the Fist French Intervention (AKA Pastry War), immigration lost all of its supporters; like most countries rather than looking at its internal faults, Mexican politicians blamed both issues on foreign encroachment and immigration (there was an argument to be made, but as usual it is only a distraction of the main problem).
And after sentencing an Austrian Archduke to death by Mexican law, Mexico gained a really bad rep in the popular mind. It wasn't seen as an exotic land to tame and settle like the American West or the Argentinan Pampas, Mexico was a lawless barbarous nation. And while other countries had issues with the Catholic Church the confiscating of Church land and the liberals ardent anti-Catholic stand during the Reform War made it worse. As I mentioned above, it really took a generation under Porfirio Diaz to change the international perspective on Mexico, but the Revolution and Cristero War happened almost immediately after ruining what would have been a perfect time to receive European immigration post WWI. Afterward and through much of the post-WWII period Mexico mostly attracted and welcomed political assailants (mostly from the left) fleeing Europe.
Although a few Italians, Germans, Irish did trickle down they never made it in the numbers they did in other Latin countries, not to mention the USA. It seems that the one exception to the rule were Catholic Arabs, mostly Lebanese who did settle in numbers similar to other places and kinda became a "model immigrant minority".
Honestly, to really change this you need to change Mexico's fate quite a bit. You need either a POD pre-Texas and Pastry Wars (getting rid of Santa Anna helps) or an earlier stable Porfiriato style government post-Mex-American War; ideally avoid the Reform War altogether and keep Farias, Juarez, Lerdo, and Iglesias as far away from a position of power as possible. We romanticize them quite a bit today, but their lot was a bit too extreme.