Langosta can be lobster or locust. The dictionary distinguishes the two as langosta de mar or langosta de tierra. Many times you will hear just the word and have to figure out which is meant. That is normally not a problem.
I knew that langosta was the word for lobster. The way I found out it was the word for locust was when I was reading the story of John the Baptist in the Bible and it said he ate langosta. Sounds pretty fancy until you realize that it is referring to eating locusts.