Confused

I’m a little confused over here. I had what I thought was a normal 6 day period starting October 5th. Well then fast forward to today (October 17th) when I had super random spotting. I took a pregnancy test just to rule it out because it’d be weird timing and they all came back positive. How can I have a period and then a little under two weeks later have a positive pregnancy test? The test I took right before my period was negative. Has this happened to anyone? I feel too confused to be totally excited.