Let's say, I have a friend far from me and I want to send some secret messages to him. I have to say, I'm pretty newbie in security. That's why I'm wondering, does the Diffie–Hellman key exchange protocol allow me make a secure communication with him by sending a public key to him and them after all necessary computations, get a secret key (which will be the same for us both, of course) and use it for encrypting/decrypting the messages from and to each other? And our communication will be secure, correct?
Diffie-Hellman allows two parties to generate a secret key which cannot be recovered by someone snooping on the communication. This secret key can be used to set up a secure channel between the two parties that ran the DH protocol.
The secret key is established between the two parties that exchanged the initial messages. If you send out one message and receive a response, you have no way to know that this message comes from your friend. It could come from a man-in-the-middle instead. A MitM can reply to your message and send a message to your friend, and thus set up one secret key to communicate with you and one to communicate with your friend. Form that point, both you and your friend have a secure channel with the MitM, who can choose to relay messages and snoop on them, or modify them, or withhold them, or inject messages as he wishes.
There is no way to set up a secure channel without authentication. If you want to be sure that you're communicating with your friend, then you need to know something about your friend before the protocol starts, so that you can tell your friend from an attacker. For example, you might have your friend's public key. Your friend faces the same problem.
Once each party knows the other's public key, DH is a possible way of establishing a secure channel. The DH setup messages are signed by the public key, so the receiving party can check their authenticity.