An iterator is an object that enables a programmer to traverse through all the elements in a collection, such as an array or a list, typically using a loop. It provides a way to access elements sequentially without exposing the underlying structure of the collection.