Castleford coach Daryl Powell felt his side were lucky to keep their derby dominance going after hanging on to beat Wakefield 23-18.
The Tigers dominated the first half and led 23-6 in the 48th minute but failed to score another point.
Trinity rallied and almost stole a late win after tries by Tom Johnstone and Lee Kershaw in the final 20 minutes.
But Castleford held on to extend their winning run over their neighbours to 16 games.
“It was two halves,” Powell said.
“I thought we were really good in the first half, defensively we were outstanding. We controlled territory and made some really smart plays.
“In the second half we were terrible. It was the complete opposite. Wakefield stepped up and we could have easily lost it in the end.
“We ended up clinging on at the end. We were our own worst enemy.”
The tight victory keeps Castleford in the race for the semi-finals ahead of a meeting with Hull.
“It’s a big game,” Powell said.
“We’ve got five games left now and we’ve broke them up and focused on a couple of blocks. It’s a tough game but we’re getting used to tough games.
“We’ve been to Leeds, we’ve been to St Helens. It was a good to get a win at home today but Hull FC are a difficult team. We know we’ll have to be at our best in that game.
“If we can win our next two games we’re in the battle for the semis.”
Wakefield coach Willie Poching has bemoaned his team’s slow start.
“It was a bit of a mix really,” Poching admitted.
“I’m disappointed with our first-half effort in particular. We had to have some words at half-time to fix our mindset because I didn’t think we were quite at the races.
“When it was 19-6 down I think we were in a position we deserved to be in because of our lack of aggression and punch defensively.
“We had to discuss and address a change of mindset and when we changed it in the second half we were a really different team, and for that I’m pretty happy with it.
“We started to restrict some of their meterage and made them kick a bit further up the field, and we played a bit more football up at their end of the field, which kept giving us some opportunities that we didn’t create in the first half.”