The open and anonymous nature of peer-to-peer (P2P) networks makes it an ideal medium for attackers to spread malicious contents, which in turn leads to lower quality of network services due to lack of effective trust management mechanism. To improve the quality of services (or transactions), this paper proposes a novel trust and reputation model, named as GroupTrust, based on peer group and evaluation similarity degree in P2P networks. In the proposed model, trust relationships between peers are divided into three categories: trust relationship within a peer group, trust relationship between different groups, and trust relationship between a peer in a peer group with another peer out of this peer group. The model presents the evaluation similarity degree under different context of services and gives local and global reputation computation. Experimental results demonstrate that this model can get more real trust value and deal with the malicious attacks efficiently by comparison with existing models. C