I graduated in history, with a specialization in cultural studies. Now I want to pursue a PhD in literature. Is this possible? What are the potential obstacles and how can I avoid them?
I think there is no such requirement to stay in the same field anywhere, unless you want to work with the same advisor who has narrow interests. In general, you can work on anything you like as long as you can find an advisor who will support and help you and you meet entry requirements for the doctorate. It is good to still be a bit of a generalist at the MS level, but doctoral studies will pretty much force you into a narrow field. There are some exceptions, of course.
Since you are staying in the humanities, there shouldn't be a lot of problems, provided you've studied in the US, at least. You probably have sufficient background in most of the required topics. You might need a course or two that a lit major might have taken as an undergrad, but I suspect it isn't extensive. Again, in the US, these are probably open to grad students.
Outside the US it might be a different story, and I can't speak to that. It would depend on the entry requirements and finding an advisor.