Yorkshire 258 for 7 (Ballance 71, Lyth 52, Rafiq 52*) beat Leicestershire 238 (Delport 68, Carver 3-24) by 20 runs

Gary Ballance went past 1,000 runs for the season in all cricket as Yorkshire beat Leicestershire in their final Royal London one-day Cup group match at Headingley tonight, although it was not enough for the hosts to seal a home semi-final.

The Foxes recovered from losing Mark Pettini four balls into their chase of 259 in 45 overs to reach 107 for 1 in the 14th over with a play-off place beckoning.

But they slipped to 165 for 7 in the 29th over and later 238 all out as they lost by 20 runs and failed to qualify for the knockout stage.

Yorkshire came into this engaging match already qualified, but a Worcestershire win at Derbyshire has consigned them to a home play-off match against the third-placed side in the South Group next month.

White Rose captain Ballance hit 71 off 66 balls in his 14th innings of the summer as the Vikings made 258 for 7 from 45 overs.

Ballance is the country's leading run-scorer with 1,027 at an average of 93.36.

But spinners Azeem Rafiq and Karl Carver also had a huge impact on a match delayed by an hour due to rain.

Off-spinner Rafiq hit a scintillating 30-ball 52 not out and took two important wickets, while left-arm spinner Carver was superb for his 3 for 24 from nine overs as the Foxes lost 6 for 58 through the middle of their innings.

The took 5 for 70 from 18 overs between them.

Adam Lyth hit 52 before Rafiq cut loose at the end of the home innings.

Leicestershire were well placed after Gavin Griffiths took two of Yorkshire's first four wickets to fall for 26 as they slipped from 72 without loss.

But Ballance, later out hit wicket for the second time this season, and Tim Bresnan shared a fifth-wicket partnership of 73 inside 15 overs to kick-start a recovery which later saw 72 runs come from the final six overs.

Rafiq offered a skied return catch to Dieter Klein on two, although keeper Lewis Hill perhaps should have got there.

Rafiq went on to hit three fours and as many sixes in a 29-ball fifty.

Yorkshire then made the ideal start to their defence when Bresnan had Pettini caught at slip for a duck.

But Cameron Delport and Ned Eckersley did not let that deter them and blazed a trail, reaching 100 for 1 in the 13th over.

Left-handed Delport hit three sixes in a 36-ball fifty before holing out to long-off off Rafiq for 68 midway through the 14th over, ending a second-wicket stand of 107 in 13 overs

He then bowled Mark Cosgrove for a duck two balls later.

Carver, given his chance because of the absence of Yorkshire's quartet of England players, then really put the skids under the Foxes.

He bowled Eckersley, had Hill caught at square cover and got Parkinson caught and bowled as the score fell to 165 for seven.

Leicester skipper Clint McKay later hit 35 in a ninth-wicket stand of 42 with Klein to give the visitors a glimmer at 231 for 8 in the 40th before Matthew Fisher and Matthew Waite claimed wickets at the death as the visitors fell 21 short.

Leicestershire head coach Pierre de Bruyn said: "It's a very quiet changing room. We were that close to making the play-offs, but we just missed a trick at 107 for 1 after 13.4 overs. We'd set the platform for ourselves. Unfortunately our dismissals were soft, very sloppy.

"We managed to pull it back at the end. But if you look at our dismissals, we're much better than that."