The Ruy Lopez is one of the most popular openings, with such a vast number of variations that in the Encyclopaedia of Chess Openings all codes from C60 to C99 are assigned to them.
The opening is named after the 16th century Spanish priest Ruy López de Segura, who made a systematic study of this and other openings in the 150-page book on chess Libro del Ajedrez written in 1561. Although it bears his name, this particular opening was included in the Göttingen manuscript, which dates from around 1490. Popular use of the Ruy Lopez opening did not develop, however, until the mid-19th century when Carl Jaenisch, a Russian theoretician, "rediscovered" its potential. The opening remains the most commonly used amongst the open games in master play; it has been adopted by almost all players during their careers, many of whom have played it with both colours. Due to the difficulty imposed on Black's player, and the fact that Lopez was a priest during the Inquisition, a common nickname for the opening is "The Spanish Torture".
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).
 Main variations
The theory of the Ruy Lopez is the most extensively developed of all open games, with some lines having been analysed well beyond move thirty. At nearly every move there are many reasonable alternatives, and most have been deeply explored. It is convenient to divide the possibilities into two groups based on whether or not Black responds with (3...a6), which is named the Morphy Defence after Paul Morphy, although he was not the originator of the line. The variations with Black moves other than 3...a6 are older and generally simpler, but the Morphy Defence lines are more commonly played.
 Black defences other than 3...a6
Of the variations in this section, the Berlin and Schliemann Defences are the most popular today, followed by the Classical Defence.
- 3...g6 (Smyslov Defence or Barnes Defence)
- 3...Nge7 (Cozio Defence)
- 3...Nd4 (Bird's Defence)
- 3...d6 (Steinitz Defence)
- 3...f5!? (Schliemann Defence)
- 3...Nf6 (Berlin Defence)
- 3...Bc5 (Classical or Cordel Defence)
 Smyslov Defence
The Smyslov Defence, Fianchetto Defence, or Barnes Defence (ECO C60), 3...g6, is a quiet positional system played occasionally by Vasily Smyslov and Boris Spassky, becoming popular in the 1980s when it was shown that 4.c3 a6! gives Black a good game.
It was later discovered that 4.d4 exd4 5.Bg5 instead of 4.c3 a6 gives White the advantage, and as such the variation is rarely played today. An interesting gambit line 4.d4 exd4 5.c3 has also been recommended by Alexander Khalifman, although some of the resulting positions have yet to be extensively tested.
 Cozio Defence
The Cozio Defence (ECO C60), 3...Nge7, is distinctly old-fashioned, and the least popular of the defences at Black's third move. Although Bent Larsen used it occasionally with success, it remains one of the least explored variations of the Ruy Lopez.
 Bird's Defence