Was becomes were when the tense is conditional, i.e. a condition is mentioned. ('Would' usually goes hand in hand in this tense too)
"If I were richer I would go to Spain."
"If I weren't so short I would be able to reach the top shelf!"
Were is also used if a wish is expressed:
"I wish I were taller."