Take a Spanish class before visiting Spain. Make sure that the teacher has experience with the Spanish vernacular. Verify that the class has an audio segment for repetition learning and recitation. Pay attention to the lecture and do the class assignments. Pronounce the words the way the teacher, or audio, pronounces them.
Purchase Spanish language books designed to teach you Spanish. Go through the lessons, and practice the exercises. Start each lesson by memorizing the new Spanish words. Review the chapter's lessons. Apply the concepts you learned to that lesson's exercises. Complete the entire book.
Buy Spanish language software from a bookstore or online that offers an audio feature. Select a program that allows you to speak into a microphone. Fine-tune your pronunciation, intonation and other aspects of speech.
Once you’re in Spain, find local Spaniards. Instead of visiting the usual tourist spots, go to a bar or coffee shop, where you can talk to a local. Place your orders in Spanish. When listening to the locals speak, note how they emphasize words. Keep listening until you internalize the rhythm.
Join the conversation whenever possible. Keep working on matching your words, sentence structures and word emphasis with the locals’ usage. Continue noting how they pronounce and emphasize words and the phrasing they choose.