Spears were used successfully in combination with a shield , to keep the enemy at a distance, almost defensive.
Think about it, your only weapon is a spear and you throw it at the enemy and miss, you are unarmed.
Not the offensive weapon of choice.
Spears were very rarely used as thrown weapons. Certainly not when it was your primary weapon. Most spears would have been pretty bad as a thrown weapon because they weren't designed as one.
I have thought about it. You've thought about a spear as a thrown weapon and only a thrown weapon, so you have reached an incorrect conclusion.
One-handed spears were often used with a shield, yes. As were all one-handed weapons. 1H weapon plus shield is better than 1H weapon and an empty hand, obviously. But 2H spears were used successfully without a shield. By choice. Over a sword. Because spear beats sword in many circumstances. Reach matters a lot, as does weapon speed, and a spear can be quickly shortened if required (by changing your grip). A spear can even be used as an effective club at a push, by changing grip and using the blunt end. A spear is a very effective hand to hand weapon and was frequently an offensive weapon of choice. More often than a sword was.
EDIT:
I'd like to add something about offensive/defensive...in a fight, pretty much everything was both. You refer to a spear being used "to keep the enemy at a distance, almost defensive". That was also a major use of other weapons, especially swords. If you're fighting as a matter of life and death in hand to hand combat with weapons, your main objective is defence. You want to keep your enemy at a distance until
you're making an attack and even then you should still be preprared in defence. You only attack if you think you can do so without being hit before, during or after your attack. It's not at all like sports fencing with rules that state that all that matters is who hits
first. You have to hit without being hit. Even if you've inflicted a fatal wound on your enemy, they're not going to die immediately and probably won't be incapacitated immediately, so even if they're not already in the process of attacking you they will probably have time to do so. If you're not also defending, you both die. Not an ideal outcome for you. Particularly bearing in mind that before modern medicine any wound could quite easily be fatal.
Even armour, which was designed solely for defence, was also used in offence. Unarmed combat was a thing and was specifically taught as part of fighting even in fighting systems not at all associated with umarmed combat, e.g. western European systems for fighting with hand to hand weapons. Sometimes you'd be too close to use a weapon, sometimes you'd use unarmed combat to make your enemy vulnerable to your weapon. It was a necessary skill in fighting outside of formal duels and sports contests with rules that forbade it. If you're wearing good armour on your arms, your forearm becomes an effective club. If you're wearing gauntlets, your fist becomes an effective club. If you're wearing a helmet, your head becomes an effective club. In all such cases, you can use as much force as you can without any concern about injuring yourself.
So I think the offensive/defensive split for equipment is not as clear-cut as it might seem to be.