Yes. You can cast any spell using a slot of the same level as the spell, or higher.
From PHB page 201, Chapter 10: Spellcasting:
When a character casts a spell, he or she expends
a slot of that spell's level or higher, effectively "filling"
a slot with the spell. [...]
and, later on the same page:
CASTING A SPELL AT A HIGHER LEVEL
When a spellcaster casts a spell using a slot that is of a
higher level than the spell, the spell assumes the higher
level for that casting. For instance, if Umara casts magic
missile using one of her 2nd-level slots, that magic
missile is 2nd level. Effectively, the spell expands to fill
the slot it is put into.
Some spells, such as magic missile and cure wounds, have more powerful effects when cast at a higher level, as detailed in a spell's description.
Note: In your example, you had both 3rd and 4th level spells slots remaining. You can cast Shield with either a 3rd or 4th level slot but (as there is no enhanced effect for that spell when cast at higher levels - a Shield spell is a Shield spell no matter what level it's cast at), it would be best to cast it as third level spell - keeping the 4th level slot for future 4th-or-lower level spells. Shield doesn't benefit from higher slot levels, but some other level 1-3 spells you might want to cast do.
In other words, cast it with the lowest level slot that will achieve the desired effect, taking into account any possible enhancements from casting at higher slot levels
For example, as mentioned by Mark Cogan, when casting Dispel Magic or Counterspell at higher levels, each increase in slot level increases the level of spell which can be automatically dispelled/interrupted without a spellcasting ability roll.
Similarly, Fireball can be cast using any slot of level 3 or higher - but you don't need to use a 9th level slot against a bunch of kobolds unless you have no lower-level slots remaining.