No, an attack with Eldritch Blast is not made "with a ranged weapon"
A quick note before we begin: the title of the question refers to any "ranged spell that requires an attack roll," which is a very broad category. But the body of the question specifically wants to know if Eldritch Blast could be used with the Sharpshooter feat. Thus, this answer concentrates mainly on Eldritch Blast, but will give some notes on other spells.
First, let's look at the text of the feat Sharpshooter, specifically the third bullet point (PHB, p. 170, bold added):
Before you make a ranged attack with a ranged weapon with which you are proficient, you can choose to take a -5 penalty to the attack roll. If you do so and the attack hits, it deals +10 damage.
This means the applicability of the feat to the spell Eldritch Blast relies on that spell being an "attack with a ranged weapon." So is it?
In the real world, what is and isn't a "weapon" is largely a matter of opinion and circumstance. Arguments have been (successfully) made in court that categorized such disparate things as a hurled alligator, a fish, and (no kidding) an animated GIF as deadly weapons.
However, in DnD we have more simple guidelines. According to the Player's Handbook, p. 14:
For attacks with ranged weapons, use your Dexterity modifier for attack and damage rolls. A weapon that has the thrown property, such as a handaxe, can use your Strength modifier instead.
This provides us with a simple rule: unless we've been given a rule that provides an exception (such as the Hexblade Warlock's feature that lets them attack with Charisma when using a weapon), if an attack doesn't use Dexterity (or Strength if it has the thrown property), then it isn't an "attack with a a ranged weapon." 1
Does Eldritch Blast use dexterity? Well, the rules identify the attack made with Eldritch Blast to be a "ranged spell attack" (PHB, p. 237), and the rules on such attacks state (PHB, p. 205):
Your attack bonus with a spell attack equals your spellcasting ability modifier + your proficiency bonus.
Warlocks use Charisma as a spellcasting ability, and as far as I know every class that can cast spells as a class feature uses either Inteligence, Charisma, or Wisdom as such a spellcasting ability2. Thus, spell attacks do not count as attacks made "with a ranged weapon."
1: There are also exceptions to the contrapositive of this rule (i.e. the original quote above). For example, the Spell Magic Stone allows one to make a Ranged Spell attack, but also can involve an attack with a sling, a ranged weapon, that hurls a projectile. In that case, you would make a ranged spell attack, but also would be making an "attack with a ranged weapon." Since Eldritch Blast does not similarly allow/require you to use a ranged weapon as part of its attack, Eldritch Blast does not provide a similar exception.
2: There are rare instances where a spell can be cast with Dexterity as a spellcasting modifier. For example, Variant Humans with the Mark of Passage (Eberron Rising from the Last War, p. 46) can cast the Misty Step spell once (recharges on a long rest) using Dexterity as their spellcasting modifier. If a spell ever with a spell attack roll allows you to use Dexterity as the spellcasting modifier, then the above objection would not apply. However, I have yet to find an instance of this anywhere in the rules.
What if the weapon is a spellcasting focus? (probably not)
Ok, let's leave aside for a moment that the spell Eldritch Blast has no material component, and thus a focus isn't used in its casting at all (which should end the conversation immediately). Let's pretend that it did, and ask if Sharpshooter could still apply.
In this instance, the rules are unclear. Does using a ranged weapon as a focus for a spell with an attack roll (such as through the Ruby of the War Mage [XGtE] ) count as making an "attack with a ranged weapon"? The question relies on an interpretation of the semantics invovled, and must go beyond RAW (rules as written). Fortunately, when we are attempting to figure out what the rules mean beyond their literal statement, we can turn to the designers to give us their RAI statements (rules as intended).
Jeremy Crawford (lead designer of DnD 5e) was asked the following:
Can you use a longbow in melee to get GWM and Sharpshooter in a single attack for +20 damage?
(NOTE: At the time, there was no requirement that you make a "ranged attack" in the text of Sharpshooter).
His (unofficial) reply was the following:
If you use a weapon in a way that turns it into an improvised weapon—such as smacking someone with a bow—that weapon has none of its regular properties, unless the DM rules otherwise.
He also made the following (unofficial statement):
DM's call. To me, a weapon is improvised if used counter to its design (e.g., a slashing weapon not slashing).
While these are not "rules," they do give us guidance on how a rule applies. A DM gets to make their own call on whether or not using a weapon as a focus makes it an "improvised weapon," but there is a very reasonable argument that it should. After all, a bow used as a weapon focus is not being used for its intended purpose (shooting arrows), but rather being used "counter to its design."
So if a DM rules in this way, and a ranged weapon was used as an arcane (or druidic, or divine) focus for a spell attack (without also shooting an arrow) , the above tweet indicates that it ceases to be considered a ranged weapon while being used in this way. Thus even if the spell attack was made using a ranged weapon as an arcane focus, it still would not qualify as an "attack with a ranged weapon" for the purposes of the Sharpshooter feat, unless the weapon was also being used for its intended purpose as part of the spell (like a melee weapon is used in the spell Green Flame Blade).