It is difficult to say why the spotting occurred as you did not mention at what time of your cycle you had the intercourse. If it happened to be mid-cycle (ovulation is inhibited by the pill), you may suspect a failure. It is more likely that the spotting is due to the pill. If you wish to confirm early on, before you get your next period, you can go for the serum beta-hCG
test. Please get checked for the presence of any infection also. Wish you good health.