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?