This diagram shows the sun (yellow) on the right, the earth (blue) and the moon (grey; the illuminated side is light grey).
Because the moon is much closer to the earth than the sun, the magnitude of its tide-generating potential (olive green) is larger than that of the sun (red).
When the sun and the moon are aligned at full and new moon their tide-generating potentials combine and produce the largest tides (spring tides). This occurs twice during a full lunar cycle, so the period of spring tides is 1/2 of one complete lunation.
At first and third quarter the two potentials compensate each other in part, and the tides are smallest (neap tides).