York City midfielder Patrick McLaughlin scored at both ends as they beat Oxford to end United's 100% start to the League Two season.
City led after 15 seconds when Ryan Clarke failed to deal with McLaughlin's shot and Michael Coulson tapped home.
U's striker Deane Smalley had a penalty saved by Michael Ingham before Ashley Chambers made it 2-0 from 16 yards out.
McLaughlin deflected Adam Chapman's corner into his own net, before making amends after Michael Raynes' error.
The result, York's first home win in the Football League
since January 2004,
knocked Oxford off top spot in the table.
VIEWS FROM THE DRESSING ROOM
York City manager Gary Mills told BBC Radio York:
"We're here to entertain, we're here to try and win football matches, we're here to enjoy it.
"We were 1-0 up and then obviously a penalty (for them) and a great save from Ingham. He's pulled off a couple of great saves in the first half which enabled us to go on and win the game.
"I'm delighted. I've said I thought the first game (of the season) flattered Wycombe.
"It was a weird day for us and since then we've shown what we've got with seven points in the last three games."
Oxford United manager Chris Wilder told BBC Radio Oxford:
"We should have got three points, without a shadow of doubt. We beat ourselves.
"We conceded three really poor goals and the timing of the first one was ridiculous.
"We'll look at this and wonder how we have not won. We haven't won because we've gifted three really poor goals to the opposition.
"We've had 17 crosses in the first half but haven't picked out the right run to score."
York 24 Ingham 02 Oyebanjo 04 Smith 06 Parslow 22 Carlisle 27 Taylor 13 Smith 26 McLaughlin 09 Walker (Blair - 71' ) 10 Chambers Booked (Challinor - 87' ) 11 Coulson (Fyfield - 79' ) Substitutes 01 Musselwhite 16 Fyfield 12 Bullock 15 McReady 17 Blair 19 Potts 20 Challinor Oxford Utd 01 Clarke 02 Batt 04 Raynes 06 Wright 17 Capaldi 07 Chapman 08 Heslop (Craddock - 59' ) 14 Rigg (Pittman - 76' ) 18 Forster-Caskey 10 Smalley (Constable - 64' ) 15 Potter Substitutes 21 Brown 03 McGinty 24 Boateng 09 Constable 11 Pittman 28 Marsh 29 Craddock