We propose a model in which two parties select the internal organization that helps them win the election. Party choices provide incentives to the politicians who represent them. Depending on whether politicians are opportunistic or partisan, we identify four effects. First, a selection effect: intraparty competition gives parties more candidates to choose from. Second, an incentive effect: intraparty competition adds a hurdle and impacts on candidates' incentives. Third, a trust effect: because of the incentive effect, intraparty competition is a signal to uninformed voters. Finally, with partisan preferences, an ideology effect appears. Ideology is a public good in a competitive party and induces free riding. Intraparty competition is valuable when voters are badly informed or intraparty competition is weak. These results rationalize the introduction of direct primaries in the United States, the organizational changes in Western European parties since 1960, and the organizational differences between centrist and extreme parties.