Yes, that's lens flare. It's caused by a strong light bouncing around inside the lens and back to the sensor where it's recorded as the spots you see. It's hard or even impossible to avoid if the sun is actually in your shot, but if the sun (or bright light source) is outside the frame, you can use a lens hood or something else to block the light from hitting the front of the lens.
As Forkie is alluding to, is that having a filter in front of your lens is a likely cause of flare. It just creates another surface for the light to reflected off of. That is why expensive filters have anti-reflective coatings, to reduce flare. Cheap filters don't have the coatings (or just a less effective type), so they are more prone to flare.