Exploring fault diagnosis methods for mechanical equipment with weak dependency on annotated data is essential for industrial production. Contrastive learning (CL), capable of learning representations without labeling information, has achieved satisfactory performance in mechanical fault diagnosis. However, current CL-based approaches mainly encounter two limitations. First, the pre-training stage uses either unannotated or annotated samples exclusively while the fine-tuning stage solely relies on annotated ones, leading to inefficient sample utilization. Second, the representation learned by contrastive loss alone in the pretext task is sub-optimal for downstream diagnostic tasks. To address these issues, this paper proposed a novel diagnostic framework based on label-guided contrastive learning (LgCL) and weighted pseudo-labeling (WPL) strategy to improve fault diagnosis accuracy. In the pre-training stage, the proposed LgCL integrates two types of contrastive loss together with classification loss, enabling the encoder to learn discriminative representations that directly benefit the downstream diagnostic task. The devised hybrid fine-tuning strategy allows both labeled and unlabeled data to participate in fine-tuning via pseudo-labeling, enhancing model generalization. The pertinently designed WPL strategy mitigates the defect of noisy pseudo labels. Comparison and ablation experiments on two public datasets and one self-designed dataset validate the superiority of the proposed method for fault diagnosis with limited annotated data, with diagnostic accuracies improved by 25.30%, 5.47% and 10.02% over supervised, semi-supervised and contrastive learning methods, respectively.