user19115: I was White in this position, and Black had just played f6.
[FEN "r1bqkb1r/ppppn1pp/2n2p2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 0 1"]

I played c3 to prepare a push of d4 and strike the center.
When analyzing this position later, the engine suggested that 5. d4 Nxd4 6. Nxd4 exd4 7. Qxd4 was superior (+1.7) than my 5. c3 (+0).
I don't really understand what White advantage has in this line. In general, I don't really know when I should exchange the d4 pawn in the Ruy Lopez and what benefit I get from such exchanges of central pawns. Can anyone help me understand?

user13012: The Ruy Lopez is a very flexible and therefore subtle opening. Black has a wide choice of replies and really has a kind of initiative in that the onus is on White to find a good response to whatever Black does. I take it that this game began with 1.e4 e5 2.Nf3 Nc6 3.Bb5 Ne7. This is the Cozio Defence. This has never been all that popular, but it has at least one Grandmaster proponent. This is Alexey Dreev, and you might like to look at his online e-book. It has also been played by Levon Aronian ans Sergey Karjarkin
A critical line is 4.Nc3 g6 5.d4 exd4 6.Nd5 and there is a lot going on that is quite different from the lines that been discussed.
In your game you played 4.0-0 which cannot be a bad move but is not quite as ambitious as the line above. The timing of Whites push to d4 is very critical in this line. Your opponents move of 4..f6 is well-motivated to hold the center, but badly timed. There is a line in the Steinitz Defence Deferred (3..a6 4.Ba4 d6 5.Bxc6+ bxd6 6.d4 and now ..f6 is the book move. It is safer after the exchange on c6 because White has given up his light squared bishop. But in your game, ..f6 was badly timed because you still have that nice Bishop and the immediate d4 forces Black to give up the center. This is not so much a matter of tempi, but Blacks pawn structure does not then fit with any nice pattern of development.
A great deal could be said about the niceties of d4 in the Lopez. You might try playing the Cozio yourself. You will puzzle almost every opponent below master strength.

user4418: f6 is a shockingly bad move which badly weakens black's kingside and does nothing for his development.
d4 would take advantage of this and keep the initiative. c3 is a weak move which gives black the time he needs to strike in the now reinforced center and justify his previous bad play. Black can play d5 and suddenly it is black who has the initiative. For example:
[FEN "r1bqkb1r/ppppn1pp/2n2p2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 0 1"]

1. c3 (1. d4 exd4 2. Nxd4 Nxd4 3. Qxd4 Nc6 4. Qd1) d5! 2. exd5 Qxd5

Now black is threatening Bg4 and O-O-O and he will have a fine game.

In general, I don't really know when I should exchange the d4 pawn in
  the Ruy Lopez and what benefit I get from such exchanges of central
  pawns.

Apart from just knowing the opening moves it is also important to understand two other things:

Your plans
Your opponent's plans

In general in king's pawn openings any time black can play d5 successfully he has equalised and the opening has been a success. You need to understand this and make sure you don't allow this without extracting some other concession from black.

user12873: The moves ...Nge7 and ...f6 slow down Black's development and he will need a few tempi to castle. Meanwhile, White is already castled and is sufficiently developed. This gives you enough incentive to blast open the centre with d4, since Black is ill-equipped to respond effectively.
Normally pushing d4 like this without c3 in the Ruy Lopez isn't a good idea. However, this is an exception because of how inefficiently Black is developing.

user19877: First, I agree that f6 is both weakening and a waste of time.
The real crux of the matter is that in most double-king pawn openings, white tries to play d4 and after the trade e5xd4, he tries to outpost a N on d5, which exerts great pressure on black. If black can play d5, and I do not agree that he has the initiative there after the better d3, he does get easy equality with plenty of space.
In both this opening, and in most Sicilians, you should be on the lookout for when black can play d5. If he gets it in, then he usually has gained equality, so you want to think prophylactically, and play moves that inhibit d5.
Your plan of trying to put two pawns in the center is admirable, but if it were possible, it would be excellent, however, it is just not possible there.

19115: <p>I was White in this position, and Black had just played f6.</p>

<pre><code>[FEN "r1bqkb1r/ppppn1pp/2n2p2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 0 1"]
</code></pre>

<p>I played c3 to prepare a push of d4 and strike the center.</p>

<p>When analyzing this position later, the engine suggested that 5. d4 Nxd4 6. Nxd4 exd4 7. Qxd4 was superior (+1.7) than my 5. c3 (+0).</p>

<p>I don't really understand what White advantage has in this line. In general, I don't really know when I should exchange the d4 pawn in the Ruy Lopez and what benefit I get from such exchanges of central pawns. Can anyone help me understand?</p>
 13012: <p>The Ruy Lopez is a very flexible and therefore subtle opening. Black has a wide choice of replies and really has a kind of initiative in that the onus is on White to find a good response to whatever Black does. I take it that this game began with 1.e4 e5 2.Nf3 Nc6 3.Bb5 Ne7. This is the Cozio Defence. This has never been all that popular, but it has at least one Grandmaster proponent. This is Alexey Dreev, and you might like to look at his online e-book. It has also been played by Levon Aronian ans Sergey Karjarkin</p>

<p>A critical line is 4.Nc3 g6 5.d4 exd4 6.Nd5 and there is a lot going on that is quite different from the lines that been discussed.
In your game you played 4.0-0 which cannot be a bad move but is not quite as ambitious as the line above. The timing of Whites push to d4 is very critical in this line. Your opponents move of 4..f6 is well-motivated to hold the center, but badly timed. There is a line in the Steinitz Defence Deferred (3..a6 4.Ba4 d6 5.Bxc6+ bxd6 6.d4 and now ..f6 is the book move. It is safer after the exchange on c6 because White has given up his light squared bishop. But in your game, ..f6 was badly timed because you still have that nice Bishop and the immediate d4 forces Black to give up the center. This is not so much a matter of tempi, but Blacks pawn structure does not then fit with any nice pattern of development.</p>

<p>A great deal could be said about the niceties of d4 in the Lopez. You might try playing the Cozio yourself. You will puzzle almost every opponent below master strength.</p>
 4418: <p>f6 is a shockingly bad move which badly weakens black's kingside and does nothing for his development.</p>

<p>d4 would take advantage of this and keep the initiative. c3 is a weak move which gives black the time he needs to strike in the now reinforced center and justify his previous bad play. Black can play d5 and suddenly it is black who has the initiative. For example:</p>

<pre><code>[FEN "r1bqkb1r/ppppn1pp/2n2p2/1B2p3/4P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 0 1"]

1. c3 (1. d4 exd4 2. Nxd4 Nxd4 3. Qxd4 Nc6 4. Qd1) d5! 2. exd5 Qxd5
</code></pre>

<p>Now black is threatening Bg4 and O-O-O and he will have a fine game.</p>

<blockquote>
  <p>In general, I don't really know when I should exchange the d4 pawn in
  the Ruy Lopez and what benefit I get from such exchanges of central
  pawns.</p>
</blockquote>

<p>Apart from just knowing the opening moves it is also important to understand two other things:</p>

<ul>
<li>Your plans</li>
<li>Your opponent's plans</li>
</ul>

<p>In general in king's pawn openings any time black can play d5 successfully he has equalised and the opening has been a success. You need to understand this and make sure you don't allow this without extracting some other concession from black.</p>
 12873: <p>The moves ...Nge7 and ...f6 slow down Black's development and he will need a few tempi to castle. Meanwhile, White is already castled and is sufficiently developed. This gives you enough incentive to blast open the centre with d4, since Black is ill-equipped to respond effectively.</p>

<p>Normally pushing d4 like this without c3 in the Ruy Lopez isn't a good idea. However, this is an exception because of how inefficiently Black is developing.</p>
 19877: <p>First, I agree that f6 is both weakening and a waste of time.</p>

<p>The real crux of the matter is that in most double-king pawn openings, white tries to play d4 and after the trade e5xd4, he tries to outpost a N on d5, which exerts great pressure on black. If black can play d5, and I do not agree that he has the initiative there after the better d3, he does get easy equality with plenty of space.</p>

<p>In both this opening, and in most Sicilians, you should be on the lookout for when black can play d5. If he gets it in, then he usually has gained equality, so you want to think prophylactically, and play moves that inhibit d5.</p>

<p>Your plan of trying to put two pawns in the center is admirable, but if it were possible, it would be excellent, however, it is just not possible there.</p>
