From the PHB (page 97):
Starting at 3rd level, you are at your deadliest when you get the drop on your enemies. You have advantage on attack rolls against any creature that hasn’t taken a turn in the combat yet. In addition, any hit you score against a creature that is surprised is a critical hit.
Can this feature be used also with ranged spell attacks, such as Eldritch Blast?