Morning after pill

I had sex and after he left I looked at the condom it broke. So I had him come get me and we went to the store to get the morning after pill. I just took it. But does the morning after pill actually work?