The impact that oil shocks have on stock prices in oil exporting countries has implications for both domestic and international investors. We derive the shocks driving oil prices from a fully-identified structural model of the oil market. We study their nonlinear relationship with stock market returns in major oil-exporting countries in a multi-factor Markov-switching framework. Flow oil-demand shocks have a statistically significant impact on stock returns in Canada, Norway, Russia, Kuwait, Saudi Arabia, and the UAE. Idiosyncratic oil-market shocks affect stock returns in Norway, Russia, Kuwait, Saudi Arabia and UAE. Speculative oil shocks impact stock returns in Canada, Russia, Kuwait and the UAE. Flow oil-supply shocks matter for the UK, Kuwait, and UAE. Mexico is the only country where stock returns are unaffected by oil shocks. These results shed important light on investor sentiment toward the relationship between oil shocks and stock markets in oil exporting countries.