I am an Indian working in Thailand. I have to visit Spain in Feb 2017 and on the way, I may have a layover of around 15- 24+ hours in London. Am I allowed to pass emigration and go out in city to visit places or do I need a Transit visa for my visit.
If you go through the UK's "check if you need a visa" tool you will find that you need a visa whether or not you plan to leave the airport, unless you meet one of the exceptions (such as if you hold a long-term "category D" visa for Spain, not an ordinary "category C" short-term visit visa).
To leave the airport (and pass through UK immigration), you'll need a Visitor in Transit visa. If you do not need or want to pass through UK immigration (even to recheck luggage because you have booked two separate tickets), you can apply for a Direct Airside Transit Visa.