I learned that solo in Spanish means both "alone" (the simple fact of not having anyone else around) and "lonely" (feeling sad because of being alone). Is there any way of distinguishing between these two English meanings in Spanish? Or is the context in which solo is used the only way to determine which of the two senses is intended?
Like Belisarius answered, the difference is communicated through the verb:
Yo estoy solo = I am alone (infinitive is estar)
Me siento solo = I am lonely (infinitive is sentirse)
For what it's worth: Verbs are king in Spanish and generally communicate much more meaning than English verbs. If you can dominate verbs and their nuances you're well on your way to being fluent in Spanish.
Your question was answered by belisarius, but what he last commented is a common issue, to solve it we earlier used the tittle as explained below, but recently the "RAE" (Real Academia Española) dediced to remove this rule, anyway most of the people keep on using it.
3.2.3: sólo/solo. The word solo can be an adjetive: "No me gusta el café solo"; "Vive él solo en esa gran mansión; or an adverb: "Solo nos llovió dos días"; Contesta solo sí o no". Usually as it's a "llana" word ended in vocal it shouldn't have accent. But when this word may be misinterpreted in a sentence as adverv or adjetive, we'll use the tittle in the adverb to avoid confussion: "Estaré solo un mes" (as it doesn't carry tittle, it is intepreted as adjetive: alone); meanwhile "Estaré sólo un mes" (as it carries tittle, it is interpreted as adjetive: only)