The general rule is that the reference you cite must be authoritative and provide strong evidence for the claim that you are making based on it. Readers should be able to follow the citation and see for themselves the evidence supporting the claim.
For example, if the claim is "80% of basket weavers prefer to work with Australian reeds", then the citation should be to an article which describes a rigorous survey of basket weavers, including the details of the methodology and statistical analysis. Such a study would most likely be published in a peer-reviewed journal.
Suppose you read an article in Basket Weaving Weekly Magazine that makes the same claim. Can you cite it as the source of the claim? Well, there are a few possibilities:
- The article got this claim from study in the peer-reviewed journal. In this case, you should cite the original study (not the magazine article), crediting the authors who actually did the study. (You should also read the study and make sure it actually makes that claim, and that it provides strong evidence for it!)
- Basket Weaving Weekly Magazine did a survey of its own readers, and the claim is based on the results of that survey. In this case, the article may or may not describe the methodology and details of the statistical analysis, and those may or may not be sound (up to the standards of rigorous scientific research). In this case, you'll have to determine whether the claim is even supported by strong evidence - but if it is, and the evidence and supporting details are in the magazine article, you can cite it.
- Basket Weaving Weekly Online makes the claim, but doesn't give any details about where it came from. In this case, you are lacking strong evidence for the claim and you should not state this claim as fact in your paper.
Citations are most often to peer-reviewed research articles, because most of the time, these are authoritative and include strong evidence to support whatever is being cited. But there are certainly occasions where it may be appropriate to cite something that isn't a peer-reviewed research article. (See for example this answer, or this answer.)
This is just a general rule - specific fields and specific publication venues may have written or unwritten conventions, which you should learn and follow.