Hi Carlos,
When you have a sequence of chords with melody in the 5th finger or thumb, an inner line within each chord, or octaves where fingers 3, 4 and 5 will emphasize the top notes, we call this technique "voicing" the chords or octaves. Some call it "weighting". This is a skill that does not come overnight, but needs to be developed over several weeks or even months.
Here are some helpful tips: 1) Play the melodic line with the 5th finger alone (given the piece you are working on now) several times. 2) Sing that melody aloud and then silently in your mind only. 3) Forget about voicing with your wrist or hand. You need to play the piano, including voicing technique, with the entire relaxed playing apparatus--torso, upper arm, forearm, wrist and hand, especially if it's a legato passage and requires voicing that needs to "sing" on the piano. 4) As you read the music in the passage (or if you have it memorized), form "musical intent" in your mind to voice those top notes. 5) As you execute the chords, think of applying more WEIGHT (as opposed to hitting or striking the keys) through the fifth finger to each top note in the melodic line.
In the early stages of learning voicing, you can facilitate a little by using a bit of intentional forearm rotation which will automatically tilt the hand more toward the fifth finger which will apply more weight to the top note while the other fingers play the other notes more quietly.
At first this technique will seem awkward and quite frustrating while trying to master it. But master it you will. (You should probably write the day on your calendar when you succeed with it!) So stick with it, as it's a very important principle in artistry and the piano literature. Once you learn it and become more proficient, you'll voice chords automatically as needed.
David