Beyond the straightforward math you can do to figure out approximately how it will take you to reach your desired level of language proficiency (see What is fluency?), there are two other things to consider.
Immersion is ideal
Immersion in a language exponentially increases your language hours, and inversely decreases your fluency timeline. For example, let's say you want to reach B1 proficiency,* which is estimated to take 600 language hours. If you're studying in your native country for five hours a week, it will take you approximately 120 weeks to reach this goal, a bit more than two years. But if you study in France for five hours a week and spend a couple hours every day chatting with friends, watching movies, and reading the news, you'll actually be putting in about 20 hours a week and therefore it should take you about 30 weeks - a mere seven to eight months - to achieve B1 proficiency. Definitely a lot more reasonable, and you get to live in France to boot!
Practice is paramount
If you can't live in a Spanish-speaking country, find your nearest Instituto Cervantes or community college. Take part in discussions, sign up for outings, attend seminars - anything that will give you extra exposure to the language. And if there's truly nothing available, why not create your own Spanish club? Hang flyers at the library, place a classified ad, post messages on expat sites... just get the word out that you're looking for other Spanish speakers - native or not - and you'll have plenty of practice partners in no time. More ways to practice speaking Spanish
A slippery slope
Returning to the idea of learning a language as climbing a mountain (see Realistic expectations), imagine that it's winter: ice on the ground makes the trail slippery, and you might take three steps forward only to slip back one or two. Climbing faster can help prevent much of this slippage and get you to the top that much more quickly!