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.

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.

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.

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.