Matty Blair and Jason Walker struck early in the second half to end York's four-match winless run with a 2-0 victory at Aldershot.
The home side could have been ahead at half-time had Craig Reid put his chance away rather than striking the woodwork.
They were made to pay when Walker released Blair to slide the ball past goalkeeper Jamie Young.
Walker, tripped in the box by Sonny Bradley, stepped up to convert his own spot kick and seal the three points.
VIEWS FROM THE DRESSING ROOM
Aldershot Town manager Dean Holdsworth told BBC Surrey:
"We lost possesion cheaply and got picked off. We gave away a cheap penalty, those two goals then affected everything.
"At the moment we need that first goal to give us that belief.
"Losing games is a concern, it's going to be a test now for the players... they need to stand up and be counted."
York City manager Gary Mills told BBC Radio York:
"We had numerous chances today to score a few more and along with that we've had a clean sheet as well so excellent.
"I thought the first half was a bit weird, we didn't get going first half. It was a bit dead for me.
"We addressed that at half time and Matty Blair seemed to find his second wind second half and got into it.
"He needed the game, he's not played an abundance of football and I thought we were excellent second half."
- 21 Young
- 02 Herd
- 03 Tonkin
- 04 Morris
- 05 Brown Booked (Payne - 57' )
- 06 Lancashire
- 23 Bradley
- 17 Mekki (Rodman - 57' )
- 26 Donnelly (Rankine - 84' )
- 10 Hylton
- 20 Reid Booked
- 29 Morris
- 07 Rodman
- 15 Branston
- 24 Anderson
- 08 Payne
- 09 Rankine
- 25 Appiah
- 24 Ingham
- 02 Oyebanjo
- 04 Smith
- 06 Parslow
- 16 Fyfield
- 23 Doig
- 17 Blair
- 26 McLaughlin (Reed - 60' )
- 09 Walker (Johnson - 90' )
- 10 Chambers
- 11 Coulson (Challinor - 60' )
- 01 Musselwhite
- 22 Carlisle
- 27 Taylor
- 12 Bullock
- 20 Challinor
- 07 Reed
- 14 Johnson
Live Text Commentary
Free kick awarded for an unfair challenge on Anthony Tonkin by Matty Blair. Anthony Tonkin restarts play with the free kick.89:03 Substitution
Substitution Oli Johnson on for Jason Walker.86:35
Foul by Josh Payne on Matty Blair, free kick awarded. Michael Ingham takes the free kick.83:50 Substitution
Substitution Michael Rankine comes on in place of Scott Donnelly.83:23 Full time
Full Time The referee blows for the end of the match.81:41
Foul by Lanre Oyebanjo on Danny Hylton, free kick awarded. Free kick taken by Ben Herd.79:50
Jon Challinor is adjudged to have handled the ball. Free kick taken by Jamie Young.77:47
Josh Payne takes a outswinging corner from the right by-line to the near post, Chris Smith makes a clearance.77:15
Outswinging corner taken right-footed by Josh Payne played to the near post, clearance by Jamal Fyfield.76:40
Josh Payne takes a inswinging corner from the left by-line played to the near post.76:09
Jon Challinor gives away a free kick for an unfair challenge on Josh Payne. Indirect free kick taken by Ben Herd.73:17
Alex Rodman takes a shot from just inside the penalty box which clears the bar.72:42
Scott Donnelly takes a shot. Comfortable save by Michael Ingham.71:31
Outswinging corner taken right-footed by Alex Rodman from the right by-line to the near post, clearance by Jamal Fyfield.70:02
Ashley Chambers fouled by Alex Rodman, the ref awards a free kick. Chris Doig takes the free kick.69:03
Jon Challinor takes a shot. Save by Jamie Young.67:23
The offside flag is raised against Craig Reid. Free kick taken by Michael Ingham.66:30
Jon Challinor takes a shot. Save made by Jamie Young.62:24
Anthony Tonkin gives away a free kick for an unfair challenge on Jon Challinor. Patrick McLaughlin restarts play with the free kick.60:00 Substitution
Substitution (York) makes a substitution, with Jamie Reed coming on for Patrick McLaughlin.
Substitution Jon Challinor on for Michael Coulson.51:00 Goal scored
Goal! - Jason Walker - Aldershot 0 - 2 York Power penalty scored by Jason Walker. Aldershot 0-2 York.56:50 Substitution
Substitution Josh Payne replaces Troy Brown.56:50 Substitution
Substitution Alex Rodman comes on in place of Adam Mekki.48:00
Chris Smith provided the assist for the goal.48:00 Goal scored
Goal! - Matty Blair - Aldershot 0 - 1 York Matty Blair finds the net with a goal from inside the six-yard box to the bottom right corner of the goal. Aldershot 0-1 York.51:00
Foul by Sonny Bradley on Jason Walker, Penalty awarded.45:01 Half time
Half Time It is the end of the first-half.44:20
Corner taken right-footed by Scott Donnelly from the right by-line, clearance by Lanre Oyebanjo.43:30
Chris Doig gives away a free kick for an unfair challenge on Craig Reid. Craig Reid restarts play with the free kick.40:39
Matty Blair takes a shot. Save by Jamie Young. Outswinging corner taken right-footed by Patrick McLaughlin from the right by-line, Ben Herd makes a clearance.39:22
Free kick awarded for a foul by Danny Hylton on Patrick McLaughlin. Lanre Oyebanjo restarts play with the free kick.38:20
Foul by Danny Hylton on Lanre Oyebanjo, free kick awarded. Free kick taken by Lanre Oyebanjo.37:26
Free kick awarded for a foul by Chris Smith on Craig Reid. Scott Donnelly restarts play with the free kick.34:21
Free kick awarded for an unfair challenge on Patrick McLaughlin by Troy Brown. Daniel Parslow takes the free kick.33:32
Adam Mekki is caught offside. Free kick taken by Michael Ingham.33:06
Foul by Lanre Oyebanjo on Scott Donnelly, free kick awarded. Jamie Young restarts play with the free kick.31:03 Booking
Booking Craig Reid is booked.29:57
Michael Coulson produces a header from deep inside the six-yard box that clears the bar.28:34
Matty Blair takes a shot.26:31
Corner taken right-footed by Scott Donnelly to the near post, clearance by Matty Blair.25:50
Chris Doig fouled by Adam Mekki, the ref awards a free kick. Michael Ingham takes the free kick.23:20
Strike on goal comes in from Michael Coulson from the free kick, save by Jamie Young.23:20 Booking
Booking Troy Brown booked for unsporting behaviour.23:06
Jason Walker fouled by Troy Brown, the ref awards a free kick.21:22
Corner taken by Daniel Parslow from the right by-line, Chris Smith takes a shot. Jamie Young makes a save.18:46
Outswinging corner taken by Scott Donnelly, Close range shot by Craig Reid hits the post.15:58
Matty Blair takes a inswinging corner from the left by-line to the near post, clearance by Oliver Lancashire.15:09
Scott Donnelly takes a shot. Comfortable save by Michael Ingham.12:09
Danny Hylton fouled by Lanre Oyebanjo, the ref awards a free kick. Scott Donnelly takes the free kick.10:15
Shot by Lanre Oyebanjo from outside the box goes over the target.9:12
Free kick awarded for an unfair challenge on Chris Doig by Danny Hylton. Chris Doig takes the free kick.7:36
Chris Smith concedes a free kick for a foul on Danny Hylton. Ben Herd takes the indirect free kick.7:07
Craig Reid handles the ball and concedes a free kick. Indirect free kick taken by Jamal Fyfield.6:24
Header from deep inside the area by Jason Walker goes over the bar.6:07
The referee blows for offside. Jamie Young takes the free kick.5:03
Unfair challenge on Sonny Bradley by Jason Walker results in a free kick. Indirect free kick taken by Jamie Young.0:28
Outswinging corner taken right-footed by Scott Donnelly from the right by-line, Chris Doig makes a clearance.0:00
The ref blows the whistle to start the match.
The referee blows his whistle to start the second half.
Live data and text provided by our data suppliers