Jordan Watson, 14, was subjected to a "brutal and sustained attack" in Carlisle leaving him with "terrible" head and neck injuries, on 15 June.
The city's crown court heard George Thomson, 19, of Carlisle, used a sharp implement or implements in the attack.
He and co-defendants Brahnn Finley, 19, and Daniel Johnston, 20, also from the city, deny murder.
Jordan's body was found by a passer-by the next morning in a secluded area of Upperby Cemetery, under a large tree - with "blood everywhere, even up to the trunk of the tree".
Simon Medland QC, prosecuting, said several people near the cemetery reported hearing "horrible screams" on the night Jordan died.
He said Mr Thomson's motive was an "obsessive desire" to have Jordan's 14-year-old girlfriend to himself.
He told jurors Jordan's girlfriend, who cannot be identified for legal reasons, was the "object of devoted attention" from the defendant, then aged 18.
He said: "Thomson wanted [the girlfriend] to go out with him and stop going out with Jordan Watson.
"He was to repeatedly state, leading up to the date of the murder, that he wanted Jordan out of the picture and dead, and that is what he acted upon during the meeting in the cemetery."
Mr Medland told the court co-defendants Brahnn Finley, 19, and Daniel Johnston, 20, were present during the murder and were there to "lend support" to Mr Thomson.
He said Jordan's girlfriend received an "abusive" Facebook message at 23:45, purporting to be a message from Jordan ending their relationship. However, it was Mr Thompson who sent it and Jordan was already dead.
A post-mortem examination found the boy was the victim of at least nine deep, incised wounds, with one at least penetrating through his neck tissues to his spine.
When police searched Mr Thomson's home they found a large, blood-stained Gurkha knife under his bed as well as an "unusually large" quantity of knives and weapons including a machete and a cleaver, the court heard.
Mr Thomson, of Upperby Road, Carlisle; Mr Finley, of Furze Street, Carlisle, and Mr Johnston, of Petteril Bank Road, Carlisle, all deny murder.
The trial continues.
A teenager was lured to a cemetery and killed by a rival for his girlfriend's affections, a court has been told.