At the most basic level, White's third move attacks the knight which defends the e5 pawn from the attack by the f3 knight. White's apparent threat to win Black's e-pawn with 4.Bxc6 dxc6 5.Nxe5 is illusory—Black can respond with 5...Qd4, forking the knight and e4-pawn, or 5...Qg5, forking the knight and g2-pawn, both of which win back the material with a good position. White's 3.Bb5 is still a good move, however: it develops a piece, prepares castling, and sets up a potential pin against Black's king. Since White's third move carries no immediate threat, Black can respond in a wide variety of ways. This opening has been dubbed the "Spanish Torture" because Black has to struggle a long time in order to achieve equality.
Traditionally, White's objective in playing the Ruy Lopez is to spoil Black's pawn structure; either way Black recaptures following the exchange on c6 will have negative features for him, though he thereby gains the bishop pair. White does not always exchange bishop for knight on c6, however, but usually in the various forms of the Exchange Variation (ECO C68–C69).
Read more about this topic: Ruy Lopez