Steven Patterson’s four-wicket evening burst put Yorkshire on the brink of an extraordinary County Championship victory at Chelmsford after being bowled out for just 50 on the opening day.

The seamer sent back Alastair Cook, Tom Westley, Nick Browne and Ravi Bopara in the space of 21 balls to knock the stuffing out of an Essex batting line-up that had been set an intriguing 238 to win between now and Bank Holiday Monday.

By the close on the second day, Essex still required 141 runs with six wickets intact.

On a second day of extreme swings of the pendulum, Essex, unbeaten last season, were left tantalisingly close to their first Championship defeat since September 2016, when they were beaten by Glamorgan at Chelmsford in the game that confirmed their promotion to Division One. All, however, is not won or lost yet.

Yorkshire had appeared set fair to give Essex a significantly more demanding total when they reached 276 for three. But they then lost seven wickets for 53 runs, Jamie Porter taking three of them, and Peter Siddle finishing with four for 65, eight for 72 in the match.

That Yorkshire recovered from 50 all out in their first innings thanks to the statement of intent issued from makeshift opener Jonny Bairstow, who hit 50 on the first evening. It was carried on by 19-year-old Harry Brook, who scored his maiden first-class century, improving his highest score from 38 to 124 in the process. He was eventually out after 187 balls, 13 fours, a six and a fourth-wicket stand of 86 with England captain Joe Root.

Chasing that 238 target in a nominal 224 overs after Yorkshire posted 329, the Essex openers rode their luck. Jack Brooks put down a caught-and-bowled chance before Browne had scored, and Jack Leaning failed to hang on in the slips when Cook had 20. It mattered little in the overall scheme of things.

Cook had advanced to 26 when he tried to turn Steven Patterson through the onside and got tucked up. Three balls later, Tom Westley was pinned lbw for a four-ball pair and his third duck in a row, having faced three balls against Hampshire last week.

Patterson removed Browne’s middle stump, and, two balls later had Ravi Bopara caught one-handed low down at backward point by Brook. Essex had slumped from 34 without loss to 55 for four and Patterson had taken all four for 10.

Ryan ten Doeschate then joined Dan Lawrence for a patient partnership of 42 that steered Essex into calmer waters by the close.

Yorkshire lost just one wicket in the morning session while moving serenely into a lead of 184 with only three wickets down before losing seven wickets for 53 in a hectic pre-tea spell.

Che Pujara had just hit three fours in an over from Porter when he plunged his pad outside off-stump against Siddle and looked horrified when he turned to see the same stump jutting out of the ground. The Indian had contributed 41 in a third-wicket stand with Brook worth 94 in 26 overs.

That brought in Root, on a pair, and he survived an appeal from Siddle for a catch behind before he got off the mark.

Brook had one moment’s fortune in his innings when he chipped Harmer skywards with the ball falling just short of Westley moving in from the boundary. Two fours in an over took Brook swiftly through the nineties and another off Bopara took him to three-figures five minutes before lunch. It had taken him 129 balls from which he hit 12 fours and a six.

However, the fourth-wicket pair had added just 16 post-prandial runs in 40 minutes before Root dragged on to a ball from Bopara and was gone for 35 from 81 balls. It was the catalyst for a regular procession of incoming and departing batsmen in the afternoon as Yorkshire suffered a second collapse in the match.

Brook followed shortly afterwards as he attempted to repeat his earlier assault against Harmer. This time, though, the ball flew further and Westley took a comfortable catch coming in at deep mid-on.

The pendulum continued to swing towards Essex as Gary Ballance dragged on to give Bopara his second scalp. Without another run added, and with the sixth delivery of the new-ball, Porter had Bresnan lbw to one that kept low.

Porter added two more wickets before the end, bowling Patterson and ending Leaning’s late resistance by castling him. In between, Siddle had Brooks edging to Foster.