mv /path/to/dir/filename.txt !#^:h/newname.txt

Where :

! means history expansion

# means command currently being typed

^ means the first argument

:h gets the “head” that is the directory without the filename portion