Let N(K,r) be the oriented 3-manifold obtained by rational r-surgery on a knot K in the three-sphere. Using the contact Ozsvath--Szabo invariants we prove, for a class of knots K containing all the algebraic knots, that N(K,r) carries positive, tight contact structures for every r not equal to 2sg(K)-1, where sg(K) is the slice genus of K. This implies, in particular, that the Brieskorn spheres of type (2,3,4) and (2,3,3) carry tight, positive contact structures. As an application of our main result we show that for each natural number m there exists a Seifert fibered rational homology 3-sphere M(m) carrying at least m pairwise non-isomorphic tight, nonfillable contact structures.