Ruy Lopez (Spanish Opening): Moves, Plans, Main Lines and Traps
The Ruy Lopez starts with 1.e4 e5 2.Nf3 Nc6 3.Bb5. It is one of the oldest openings in chess and still one of the most played at the very top. This guide explains the ideas, the main variations with ECO codes, a famous trap, and 383 lines you can train on Rama Chess.
What is the Ruy Lopez?
The Ruy Lopez, also called the Spanish Opening, starts with 1.e4 e5 2.Nf3 Nc6 3.Bb5. White's bishop attacks the knight on c6. That knight is the piece that defends Black's e5 pawn, so White is putting slow, long-term pressure on Black's centre.
The opening is named after Ruy Lopez de Segura, a Spanish priest who wrote about it in his chess book of 1561. More than four centuries later it is still a main weapon of world champions. Its ECO codes run from C60 to C99, a fifth of the whole C volume.
Note that 3.Bb5 does not threaten to win the e5 pawn at once. After 3...a6 4.Bxc6 dxc6 5.Nxe5, Black plays 5...Qd4 and wins the pawn back. That is why Black can answer with the calm 3...a6, the Morphy Defence, which is the most common reply.
The main ideas for both sides
White's plans
- Build the c3 and d4 centre. White plays c3 first, then d4, so that a pawn can recapture on d4.
- Keep the bishop. After ...a6 and ...b5 the bishop goes back to b3 and later to c2, where it aims at Black's king.
- The knight trip. The b1 knight often travels Nbd2-f1-g3 to join a kingside attack.
- Play on both wings. With a4 White attacks the b5 pawn; with Nh2, f4 or Ng3-f5 White turns to the king.
Black's plans
- Hold e5. Black keeps a strong pawn on e5 with ...d6, ...Be7 and castling.
- Queenside space. ...b5, ...c5 and ...Na5 or ...Nb8-d7 gain space and fight for d4.
- Counter-attack. Lines like the Marshall Attack and the Open Ruy Lopez give Black active piece play instead.
Main variations of the Ruy Lopez
The Ruy Lopez has more theory than almost any other opening. These are the lines you need to know first. Every move order is checked move by move.
| Variation | ECO | Moves | Idea |
|---|---|---|---|
| Berlin Defence | C65-C67 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 | solid; the Berlin endgame after 4.O-O Nxe4 |
| Exchange Variation | C68-C69 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Bxc6 dxc6 | White wins a better pawn majority for the endgame |
| Schliemann Gambit | C63 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 f5 | a sharp counter-gambit on f-file |
| Steinitz Defence | C62 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 d6 | old and solid, but passive |
| Open Ruy Lopez | C80-C83 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Nxe4 | Black takes e4 and plays ...d5 |
| Closed Ruy Lopez | C84-C99 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 | the long main line, slow manoeuvring |
| Marshall Attack | C89 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 O-O 8.c3 d5 | Black gives a pawn for a kingside attack |
| Breyer Variation | C94-C95 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Nb8 | the knight re-routes to d7 |
| Chigorin Variation | C96-C99 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Na5 | ...Na5, ...c5 and ...Qc7 |
| Zaitsev Variation | C92 | 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Bb7 | pressure on e4 with the bishop |
The Berlin Defence (3...Nf6) became a top-level weapon when Vladimir Kramnik used it in his 2000 world championship match against Garry Kasparov. After 4.O-O Nxe4 5.d4 Nd6 6.Bxc6 dxc6 7.dxe5 Nf5 8.Qxd8+ Kxd8 the queens are off early. Black has lost the right to castle but has the two bishops and a very solid position. Many games here end in a draw.
The Closed Ruy Lopez is the classical main line. After 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Black must choose a plan: the Breyer (9...Nb8), the Chigorin (9...Na5), the Zaitsev (9...Bb7) or the Smyslov (9...h6). The move h3 stops ...Bg4, which would pin the f3 knight.
The Marshall Attack (8...d5) is a gambit. Frank Marshall made it famous when he used it against Jose Raul Capablanca in 1918. Capablanca won that game, but today the Marshall is considered fully playable for Black. Many White players avoid it with 8.a4 or 8.h3, the so-called Anti-Marshall lines.
Stockfish 19commentaryMain variations of the Ruy Lopez: moves and commentary as text
1.e4 White puts a pawn on e4 and claims space in the centre.
1...e5 Black puts a pawn on e5 and claims space in the centre.
2.Nf3 White develops the knight to f3.
2...Nc6 Black develops the knight to c6.
3.Bb5 The Ruy Lopez starts with 1.e4 e5 2.Nf3 Nc6 3.Bb5.
3...a6 The opening is now the Ruy Lopez, Morphy Defence. Black pushes the a-pawn to a6. It attacks the bishop on b5.
4.Ba4 The bishop drops back to a4, out of danger.
4...Nf6 Black develops the knight to f6.
5.O-O White castles kingside: the king is safe on g1 and the rook comes to f1.
5...Be7 Black develops the bishop to e7.
6.Re1 The rook goes to e1.
6...b5 Black pushes the b-pawn to b5. It attacks the bishop on a4.
7.Bb3 The bishop drops back to b3, out of danger.
7...d6 Black pushes the d-pawn to d6.
7...O-O Black castles kingside: the king is safe on g8 and the rook comes to f8.
8.c3 White pushes the c-pawn to c3.
8...d5 Black pushes the d-pawn to d5. Stockfish: White is slightly better (+0.6).
8.c3 White pushes the c-pawn to c3.
8...O-O Black castles kingside: the king is safe on g8 and the rook comes to f8.
9.h3 The Closed Ruy Lopez after 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3. White prepares d4 and keeps the bishop on the a2-g8 diagonal.
9...Nb8 After 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Black must choose a plan: the Breyer ( 9...Nb8), the Chigorin (9...Na5), the Zaitsev (9...Bb7) or the Smyslov (9...h6). Stockfish: White is slightly better (+0.5).
9...Na5 After 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Black must choose a plan: the Breyer (9...Nb8), the Chigorin ( 9...Na5), the Zaitsev (9...Bb7) or the Smyslov (9...h6). Stockfish: White is slightly better (+0.6).
9...Bb7 After 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Black must choose a plan: the Breyer (9...Nb8), the Chigorin (9...Na5), the Zaitsev ( 9...Bb7) or the Smyslov (9...h6). Stockfish: White is slightly better (+0.4).
9...h6 After 3...a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.h3 Black must choose a plan: the Breyer (9...Nb8), the Chigorin (9...Na5), the Zaitsev (9...Bb7) or the Smyslov ( 9...h6). Stockfish: White is slightly better (+0.6).
The Berlin Defense (the Berlin Wall)
The Berlin Defense is 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 (ECO C65-C67). Black ignores the threat to the e5 pawn and develops the knight, attacking e4. It is one of the most solid answers to the Ruy Lopez and a top-level favourite.
The Berlin Wall (Berlin endgame). The main line goes 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.O-O Nxe4 5.d4 Nd6 6.Bxc6 dxc6 7.dxe5 Nf5 8.Qxd8+ Kxd8. The queens are gone after only eight moves. Black has lost the right to castle and has doubled c-pawns, but the bishop pair and a very solid position make up for it. White has an extra pawn on the kingside (four against three) and hopes to use it later. Stockfish 18 rates this endgame about +0.2 for White at depth 24: almost equal.
The nickname "Berlin Wall" became famous in the 2000 World Championship in London, where Vladimir Kramnik used the Berlin with Black and Garry Kasparov could not break it. Kramnik won the match without losing a game and took the title.
The Anti-Berlin. Many White players avoid the endgame with 4.d3, keeping the queens on and playing a slow Italian-style game (about +0.2 for Stockfish as well). Other tries are 4.O-O Nxe4 5.Re1 and 4.Qe2.
Is the Berlin good for you? If you like solid positions and endgames, yes. If you want sharp, attacking games with Black, choose the Sicilian or 3...a6 lines instead.
Stockfish 19commentaryThe Berlin Defense (the Berlin Wall): moves and commentary as text
1.e4 White puts a pawn on e4 and claims space in the centre.
1...e5 Black puts a pawn on e5 and claims space in the centre.
2.Nf3 White develops the knight to f3.
2...Nc6 Black develops the knight to c6.
3.Bb5 This is the Ruy Lopez. White develops the bishop to b5.
3...Nf6 The Berlin Defense is 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 (ECO C65-C67).
3...a6 If you want sharp, attacking games with Black, choose the Sicilian or 3...a6 lines instead. Stockfish: White is slightly better (+0.4).
4.O-O White castles kingside: the king is safe on g1 and the rook comes to f1.
4.d3 Many White players avoid the endgame with 4.d3, keeping the queens on and playing a slow Italian-style game (about +0.2 for Stockfish as well).
4.Qe2 The queen comes out to e2. Stockfish calls the position equal (-0.1).
4...Nxe4 The knight takes the pawn on e4.
5.d4 You can enter the Berlin endgame with 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.O-O Nxe4 5.d4, or avoid it with the Anti-Berlin 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.d3, which keeps the queens on the board.
5.Re1 Other tries are 4.O-O Nxe4 5.Re1 and 4.Qe2. Stockfish calls the position equal (+0.3).
5...Nd6 The knight drops back to d6. It attacks the bishop on b5.
6.Bxc6 The bishop takes the knight on c6. The pawn on d7 is now pinned to its king.
6...dxc6 Black takes back on c6 with the pawn.
7.dxe5 White takes on e5 with the d-pawn. White threatens to take the knight on d6.
7...Nf5 The knight moves to f5, out of danger.
8.Qxd8+ The queen takes the queen on d8, with check. It pins the bishop on c8 to the rook behind it.
8...Kxd8 The Berlin endgame after 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.O-O Nxe4 5.d4 Nd6 6.Bxc6 dxc6 7.dxe5 Nf5 8.Qxd8+ Kxd8. Queens are off, the black king stays in the centre and Black has the two bishops. Stockfish calls the position equal (+0.1).
Traps and typical tactics
The best-known trap in the Ruy Lopez is the Noah's Ark trap. It catches White's bishop with a chain of black pawns. It happens after 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 d6 5.d4 b5 6.Bb3 Nxd4 7.Nxd4 exd4. If White now grabs the pawn with 8.Qxd4?, Black plays 8...c5!. The queen must move, and then ...c4 traps the bishop on b3. Stockfish rates the position after 8...c5 as about three pawns better for Black. The lesson: in this line White should play 8.a4, 8.c3 or 8.Bd5 instead (all close to equal for Stockfish).
Other ideas to know:
- Bxf7+ tricks. The bishop on b3 or c2 often supports sacrifices on f7 or h7 when Black's king is short of defenders.
- The Bg4 pin. Before h3, Black's bishop on g4 can pin the f3 knight and increase pressure on d4.
- The e5 pawn. If Black lets the e5 pawn fall without thinking (for example after an early Bxc6 and Nxe5), check whether ...Qd4 wins it back, as in the Exchange Variation.
Stockfish 19commentaryTraps and typical tactics: moves and commentary as text
1.e4 White puts a pawn on e4 and claims space in the centre.
1...e5 Black puts a pawn on e5 and claims space in the centre.
2.Nf3 White develops the knight to f3.
2...Nc6 Black develops the knight to c6.
3.Bb5 The Ruy Lopez, or Spanish Opening, is 1.e4 e5 2.Nf3 Nc6 3.Bb5.
3...a6 The most common reply is 3...a6, the Morphy Defence.
4.Ba4 The bishop drops back to a4, out of danger.
4...d6 Black plays the d-pawn to d6 to fight for the centre.
5.d4 White puts a pawn on d4 and claims space in the centre.
5...b5 Black pushes the b-pawn to b5. It attacks the bishop on a4.
6.Bb3 The bishop drops back to b3, out of danger.
6...Nxd4 The knight takes the pawn on d4. Black threatens to take the bishop on b3.
7.Nxd4 White takes back on d4 with the knight.
7...exd4 Black takes back on d4 with the pawn.
8.Qxd4? White takes back on d4 with the queen. A blunder. a4 was the move.
8.a4 The lesson: in this line White should play 8.a4, 8.c3 or 8.Bd5 instead (all close to equal for Stockfish).
8.c3 White pushes the c-pawn to c3. Stockfish calls the position equal (+0.1).
8.Bd5 The bishop goes to d5. It attacks the rook on a8. Stockfish calls the position equal (-0.1).
8...c5! If White now grabs the pawn with 8.Qxd4?, Black plays 8...c5!.
9.Qd5 The queen moves to d5, out of danger. It attacks the rook on a8. White threatens mate with the queen on f7.
9...Be6 Black develops the bishop to e6. It attacks the queen on d5.
10.Qc6+ The queen moves to c6, out of danger, with check.
10...Bd7 The bishop drops back to d7. It attacks the queen on c6.
11.Qd5 The queen drops back to d5, out of danger. White threatens mate with the queen on f7.
11...c4 The Noah's Ark trap: after 3...a6 4.Ba4 d6 5.d4 b5 6.Bb3 Nxd4 7.Nxd4 exd4 8.Qxd4 c5 9.Qd5 Be6 10.Qc6+ Bd7 11.Qd5 c4 the bishop on b3 has no square. Stockfish: Black is winning (-2.8).
Who plays the Ruy Lopez?
Almost every world champion has played the Ruy Lopez with White, and many have defended it with Black. Kramnik made the Berlin popular, and today it is a regular guest in elite events. The Marshall Attack is a favourite of strong Black players who want active play. Engines also play the Spanish a lot; you can see examples in our engine games in the Ruy Lopez.
Is it right for you? The Ruy Lopez rewards patience and planning more than memory. If you like rich middlegames where you slowly build pressure, it is a great choice. If you want quicker, simpler attacks with White, try the Italian Game first.
Practice the Ruy Lopez in the Rama Chess trainer
Reading a guide is the first step. To make the moves stick, practise them. Our opening trainer has 383 Ruy Lopez lines. Each one is checked with Stockfish. You watch the moves with arrows, replay them from memory, then take a test. Some lines are free for everyone; the others are part of Rama Chess Premium.
The Rama Chess trainer has a very large Ruy Lopez section. A good path: start with the Berlin (C65-C67), then the Closed main lines (C84 and C88-C99). Two lines are free for everyone.
See all our chess opening guides.
Ruy Lopez FAQ
What are the moves of the Ruy Lopez?
The Ruy Lopez, or Spanish Opening, is 1.e4 e5 2.Nf3 Nc6 3.Bb5. The most common reply is 3...a6, the Morphy Defence.
Why is it called the Ruy Lopez?
It is named after Ruy Lopez de Segura, a Spanish priest who studied the opening in his chess book published in 1561. That is also why it is called the Spanish Opening.
What is the Berlin Defence?
The Berlin Defence is 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6. It is very solid. Vladimir Kramnik used it to beat Garry Kasparov in their 2000 world championship match, and it has been popular at top level ever since.
What is the Marshall Attack?
It is a gambit for Black in the Closed Ruy Lopez: 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 O-O 8.c3 d5. Black gives a pawn for a strong attack on White's king. Its ECO code is C89.
What is the Noah's Ark trap?
It is a trap where Black's a6, b5 and c4 pawns catch White's bishop on b3. It appears after 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 d6 5.d4 b5 6.Bb3 Nxd4 7.Nxd4 exd4 8.Qxd4 c5, followed by ...c4.
Is the Ruy Lopez good for beginners?
Yes, its first moves follow simple principles: develop, attack the centre, castle. But the main lines are long. Beginners should learn the plans (c3, d4, Re1, h3) rather than memorise deep theory.
What is the Berlin Wall in chess?
It is the endgame of the Berlin Defence: 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.O-O Nxe4 5.d4 Nd6 6.Bxc6 dxc6 7.dxe5 Nf5 8.Qxd8+ Kxd8. The queens come off early and Black defends a solid position with the two bishops. Kramnik used it to beat Kasparov in 2000.
How do you play against the Berlin Defense?
You can enter the Berlin endgame with 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.O-O Nxe4 5.d4, or avoid it with the Anti-Berlin 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.d3, which keeps the queens on the board.
Watch on YouTube
Prefer video? Our channels show real games move by move, with clear explanations.
Ready to practise?
You know the ideas. Now train the moves until you play them without thinking.
Test your moves against the strongest engine: Stockfish online on Rama Chess, no download.
Play the chess bots from this article on Rama Chess: Frank Marshall, Capablanca.


